def METHOD_NAME():
    connection = op.get_bind()
    # drop foreign key constraints
    with op.batch_alter_table('alias') as batch_op:
        batch_op.drop_constraint('alias_domain_name_fkey', type_='foreignkey')
    with op.batch_alter_table('alternative') as batch_op:
        batch_op.drop_constraint('alternative_domain_name_fkey', type_='foreignkey')
    with op.batch_alter_table('manager') as batch_op:
        batch_op.drop_constraint('manager_domain_name_fkey', type_='foreignkey')
        batch_op.drop_constraint('manager_user_email_fkey', type_='foreignkey')
    with op.batch_alter_table('token') as batch_op:
        batch_op.drop_constraint('token_user_email_fkey', type_='foreignkey')
    with op.batch_alter_table('fetch') as batch_op:
        batch_op.drop_constraint('fetch_user_email_fkey', type_='foreignkey')
    with op.batch_alter_table('user') as batch_op:
        batch_op.drop_constraint('user_domain_name_fkey', type_='foreignkey')
    # lower domain names
    for domain in connection.execute(domain_table.select()):
        connection.execute(domain_table.update().where(
            domain_table.c.name == domain.name
        ).values(
            name=domain.name.lower()
        ))
    # lower alternatives
    for alternative in connection.execute(alternative_table.select()):
        connection.execute(alternative_table.update().where(
            alternative_table.c.name == alternative.name
        ).values(
            name=alternative.name.lower(),
            domain_name=alternative.domain_name.lower()
        ))
    # lower users
    for user in connection.execute(user_table.select()):
        connection.execute(user_table.update().where(
            user_table.c.email == user.email
        ).values(
            email=user.email.lower(),
            localpart=user.localpart.lower(),
            domain_name=user.domain_name.lower()
        ))
    # lower aliases
    for alias in connection.execute(alias_table.select()):
        connection.execute(alias_table.update().where(
            alias_table.c.email == alias.email
        ).values(
            email=alias.email.lower(),
            localpart=alias.localpart.lower(),
            domain_name=alias.domain_name.lower()
        ))
    # lower fetches
    for fetch in connection.execute(fetch_table.select()):
        connection.execute(fetch_table.update().where(
            fetch_table.c.id == fetch.id
        ).values(
            user_email=fetch.user_email.lower()
        ))
    # lower tokens
    for token in connection.execute(token_table.select()):
        connection.execute(token_table.update().where(
            token_table.c.id == token.id
        ).values(
            user_email=token.user_email.lower()
        ))
    # lower relays
    for relay in connection.execute(relay_table.select()):
        connection.execute(relay_table.update().where(
            relay_table.c.name == relay.name
        ).values(
            name=relay.name.lower()
        ))
    # lower managers
    for manager in connection.execute(manager_table.select()):
        connection.execute(manager_table.update().where(
            sa.and_(
                manager_table.c.domain_name == manager.domain_name,
                manager_table.c.user_email == manager.user_email
            )
        ).values(
            domain_name=manager.domain_name.lower(),
            user_email=manager.user_email.lower()
        ))
    # restore foreign key constraints
    with op.batch_alter_table('alias') as batch_op:
        batch_op.create_foreign_key('alias_domain_name_fkey', 'domain', ['domain_name'], ['name'])
    with op.batch_alter_table('user') as batch_op:
        batch_op.create_foreign_key('user_domain_name_fkey', 'domain', ['domain_name'], ['name'])
    with op.batch_alter_table('alternative') as batch_op:
        batch_op.create_foreign_key('alternative_domain_name_fkey', 'domain', ['domain_name'], ['name'])
    with op.batch_alter_table('manager') as batch_op:
        batch_op.create_foreign_key('manager_domain_name_fkey', 'domain', ['domain_name'], ['name'])
        batch_op.create_foreign_key('manager_user_email_fkey', 'user', ['user_email'], ['email'])
    with op.batch_alter_table('token') as batch_op:
        batch_op.create_foreign_key('token_user_email_fkey', 'user', ['user_email'], ['email'])
    with op.batch_alter_table('fetch') as batch_op:
        batch_op.create_foreign_key('fetch_user_email_fkey', 'user', ['user_email'], ['email'])