本文整理汇总了Python中alembic.op.drop_index方法的典型用法代码示例。如果您正苦于以下问题:Python op.drop_index方法的具体用法?Python op.drop_index怎么用?Python op.drop_index使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类alembic.op
的用法示例。
在下文中一共展示了op.drop_index方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: upgrade
# 需要导入模块: from alembic import op [as 别名]
# 或者: from alembic.op import drop_index [as 别名]
def upgrade():
bind = op.get_bind()
# NOTE(sileht): mysql can't delete an index on a foreign key
# even this one is not the index used by the foreign key itself...
# In our case we have two indexes fk_resource_history_id_resource_id and
# and ix_resource_history_id, we want to delete only the second, but mysql
# can't do that with a simple DROP INDEX ix_resource_history_id...
# so we have to remove the constraint and put it back...
if bind.engine.name == "mysql":
op.drop_constraint("fk_resource_history_id_resource_id",
type_="foreignkey", table_name="resource_history")
for table, colname in resource_tables + history_tables + other_tables:
op.drop_index("ix_%s_%s" % (table, colname), table_name=table)
if bind.engine.name == "mysql":
op.create_foreign_key("fk_resource_history_id_resource_id",
"resource_history", "resource", ["id"], ["id"],
ondelete="CASCADE")
示例2: downgrade
# 需要导入模块: from alembic import op [as 别名]
# 或者: from alembic.op import drop_index [as 别名]
def downgrade():
bind = op.get_bind()
session = Session(bind=bind)
# ### commands auto generated by Alembic - please adjust! ###
op.add_column('pull_mirror', sa.Column('gitlab_id', sa.INTEGER(), nullable=True))
for pull_mirror in session.query(PullMirror):
pull_mirror.gitlab_id = pull_mirror.project.gitlab_id
session.add(pull_mirror)
session.commit()
op.drop_constraint(None, 'pull_mirror', type_='foreignkey')
op.drop_index(op.f('ix_pull_mirror_project_id'), table_name='pull_mirror')
op.drop_column('pull_mirror', 'project_id')
op.drop_index(op.f('ix_push_mirror_user_id'), table_name='push_mirror')
op.drop_index(op.f('ix_push_mirror_project_id'), table_name='push_mirror')
op.drop_table('push_mirror')
op.drop_table('project')
# ### end Alembic commands ###
示例3: downgrade
# 需要导入模块: from alembic import op [as 别名]
# 或者: from alembic.op import drop_index [as 别名]
def downgrade():
op.drop_constraint('fk_vfolder_attachment_vfolder_vfolders', 'vfolder_attachment', type_='foreignkey')
op.drop_constraint('fk_vfolder_attachment_kernel_kernels', 'vfolder_attachment', type_='foreignkey')
op.drop_constraint('pk_kernels', 'kernels', type_='primary')
op.drop_index(op.f('ix_kernels_sess_id'), table_name='kernels')
op.drop_index(op.f('ix_kernels_sess_id_role'), table_name='kernels')
op.alter_column(
'kernels', 'sess_id',
existing_type=sa.String(length=64),
type_=postgresql.UUID(),
nullable=False,
existing_server_default=sa.text('uuid_generate_v4()'),
postgresql_using='sess_id::uuid')
op.create_primary_key('pk_kernels', 'kernels', ['sess_id'])
op.drop_column('kernels', 'id')
op.drop_column('kernels', 'role')
op.create_foreign_key('fk_vfolder_attachment_vfolder_vfolders',
'vfolder_attachment', 'vfolders',
['vfolder'], ['id'])
op.create_foreign_key('fk_vfolder_attachment_kernel_kernels',
'vfolder_attachment', 'kernels',
['kernel'], ['sess_id'])
示例4: downgrade
# 需要导入模块: from alembic import op [as 别名]
# 或者: from alembic.op import drop_index [as 别名]
def downgrade():
op.drop_column('kernels', 'stdout_port')
op.drop_column('kernels', 'stdin_port')
op.drop_column('kernels', 'repl_out_port')
op.drop_column('kernels', 'repl_in_port')
op.drop_column('kernels', 'mem_slot')
op.drop_column('kernels', 'gpu_slot')
op.drop_column('kernels', 'cpu_slot')
op.drop_column('kernels', 'agent_addr')
op.drop_index(op.f('ix_agents_status'), table_name='agents')
op.drop_column('agents', 'status')
op.drop_column('agents', 'lost_at')
op.alter_column('kernels', column_name='status', type_=sa.String(length=64))
op.add_column('kernels', sa.Column('allocated_cores', sa.ARRAY(sa.Integer), nullable=True))
op.drop_column('kernels', 'cpu_set')
op.drop_column('kernels', 'gpu_set')
agentstatus.drop(op.get_bind())
kernelstatus.drop(op.get_bind())
示例5: downgrade
# 需要导入模块: from alembic import op [as 别名]
# 或者: from alembic.op import drop_index [as 别名]
def downgrade():
op.drop_index('ix_kernels_unique_sess_token', table_name='kernels')
conn = op.get_bind()
conn.execute('ALTER TYPE kernelstatus RENAME TO kernelstatus_new;')
kernelstatus_old.create(conn)
conn.execute(textwrap.dedent('''\
ALTER TABLE kernels
ALTER COLUMN "status" DROP DEFAULT,
ALTER COLUMN "status" TYPE kernelstatus USING (
CASE "status"::text
WHEN 'CANCELLED' THEN 'TERMINATED'
ELSE "status"::text
END
)::kernelstatus,
ALTER COLUMN "status" SET DEFAULT 'PREPARING'::kernelstatus;
DROP TYPE kernelstatus_new;
'''))
op.create_index(
'ix_kernels_unique_sess_token', 'kernels', ['access_key', 'sess_id'],
unique=True, postgresql_where=sa.text(
"status != 'TERMINATED' and role = 'master'"
))
示例6: downgrade
# 需要导入模块: from alembic import op [as 别名]
# 或者: from alembic.op import drop_index [as 别名]
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_constraint(op.f('fk_kernels_scaling_group_scaling_groups'), 'kernels', type_='foreignkey')
op.drop_index(op.f('ix_kernels_scaling_group'), table_name='kernels')
op.drop_column('kernels', 'scaling_group')
op.drop_constraint(op.f('fk_agents_scaling_group_scaling_groups'), 'agents', type_='foreignkey')
op.drop_index(op.f('ix_agents_scaling_group'), table_name='agents')
op.drop_column('agents', 'scaling_group')
op.drop_index(op.f('ix_sgroups_for_keypairs_scaling_group'), table_name='sgroups_for_keypairs')
op.drop_index(op.f('ix_sgroups_for_keypairs_access_key'), table_name='sgroups_for_keypairs')
op.drop_table('sgroups_for_keypairs')
op.drop_index(op.f('ix_sgroups_for_groups_scaling_group'), table_name='sgroups_for_groups')
op.drop_index(op.f('ix_sgroups_for_groups_group'), table_name='sgroups_for_groups')
op.drop_table('sgroups_for_groups')
op.drop_index(op.f('ix_sgroups_for_domains_scaling_group'), table_name='sgroups_for_domains')
op.drop_index(op.f('ix_sgroups_for_domains_domain'), table_name='sgroups_for_domains')
op.drop_table('sgroups_for_domains')
op.drop_index(op.f('ix_scaling_groups_is_active'), table_name='scaling_groups')
op.drop_table('scaling_groups')
# ### end Alembic commands ###
示例7: downgrade
# 需要导入模块: from alembic import op [as 别名]
# 或者: from alembic.op import drop_index [as 别名]
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_index(op.f('ix_likes_timestamp'), table_name='likes')
op.drop_table('likes')
op.drop_index(op.f('ix_comments_timestamp'), table_name='comments')
op.drop_table('comments')
op.drop_index(op.f('ix_posts_timestamp'), table_name='posts')
op.drop_table('posts')
op.drop_table('follows')
op.drop_index(op.f('ix_conversations_timestamp'), table_name='conversations')
op.drop_table('conversations')
op.drop_index(op.f('ix_users_nickname'), table_name='users')
op.drop_index(op.f('ix_users_email'), table_name='users')
op.drop_table('users')
op.drop_index(op.f('ix_roles_default'), table_name='roles')
op.drop_table('roles')
op.drop_index(op.f('ix_admin_timestamp'), table_name='admin')
op.drop_table('admin')
# ### end Alembic commands ###
示例8: downgrade
# 需要导入模块: from alembic import op [as 别名]
# 或者: from alembic.op import drop_index [as 别名]
def downgrade():
### commands auto generated by Alembic - please adjust! ###
op.drop_index(op.f('ix_rss_parser_feed_name_lut_id'), table_name='rss_parser_feed_name_lut')
op.drop_index(op.f('ix_rss_parser_feed_name_lut_feed_netloc'), table_name='rss_parser_feed_name_lut')
op.drop_index(op.f('ix_rss_parser_feed_name_lut_feed_name'), table_name='rss_parser_feed_name_lut')
op.drop_table('rss_parser_feed_name_lut')
op.drop_index(op.f('ix_rss_parser_funcs_version_transaction_id'), table_name='rss_parser_funcs_version')
op.drop_index(op.f('ix_rss_parser_funcs_version_operation_type'), table_name='rss_parser_funcs_version')
op.drop_index(op.f('ix_rss_parser_funcs_version_id'), table_name='rss_parser_funcs_version')
op.drop_index(op.f('ix_rss_parser_funcs_version_feed_name'), table_name='rss_parser_funcs_version')
op.drop_index(op.f('ix_rss_parser_funcs_version_end_transaction_id'), table_name='rss_parser_funcs_version')
op.drop_table('rss_parser_funcs_version')
op.drop_index(op.f('ix_rss_parser_funcs_id'), table_name='rss_parser_funcs')
op.drop_index(op.f('ix_rss_parser_funcs_feed_name'), table_name='rss_parser_funcs')
op.drop_table('rss_parser_funcs')
op.drop_index(op.f('ix_rss_parser_feed_name_lut_version_transaction_id'), table_name='rss_parser_feed_name_lut_version')
op.drop_index(op.f('ix_rss_parser_feed_name_lut_version_operation_type'), table_name='rss_parser_feed_name_lut_version')
op.drop_index(op.f('ix_rss_parser_feed_name_lut_version_id'), table_name='rss_parser_feed_name_lut_version')
op.drop_index(op.f('ix_rss_parser_feed_name_lut_version_feed_netloc'), table_name='rss_parser_feed_name_lut_version')
op.drop_index(op.f('ix_rss_parser_feed_name_lut_version_feed_name'), table_name='rss_parser_feed_name_lut_version')
op.drop_index(op.f('ix_rss_parser_feed_name_lut_version_end_transaction_id'), table_name='rss_parser_feed_name_lut_version')
op.drop_table('rss_parser_feed_name_lut_version')
### end Alembic commands ###
示例9: upgrade
# 需要导入模块: from alembic import op [as 别名]
# 或者: from alembic.op import drop_index [as 别名]
def upgrade():
### commands auto generated by Alembic - please adjust! ###
op.add_column('nu_outbound_wrappers', sa.Column('actual_target', sa.Text(), nullable=True))
op.add_column('nu_outbound_wrappers', sa.Column('client_id', sa.Text(), nullable=True))
op.add_column('nu_outbound_wrappers', sa.Column('client_key', sa.Text(), nullable=True))
op.add_column('nu_outbound_wrappers', sa.Column('groupinfo', sa.Text(), nullable=True))
op.add_column('nu_outbound_wrappers', sa.Column('outbound_wrapper', sa.Text(), nullable=True))
op.add_column('nu_outbound_wrappers', sa.Column('referrer', sa.Text(), nullable=True))
op.add_column('nu_outbound_wrappers', sa.Column('releaseinfo', sa.Text(), nullable=True))
op.add_column('nu_outbound_wrappers', sa.Column('seriesname', sa.Text(), nullable=True))
op.create_index(op.f('ix_nu_outbound_wrappers_client_id'), 'nu_outbound_wrappers', ['client_id'], unique=False)
op.create_index(op.f('ix_nu_outbound_wrappers_client_key'), 'nu_outbound_wrappers', ['client_key'], unique=False)
op.create_index(op.f('ix_nu_outbound_wrappers_groupinfo'), 'nu_outbound_wrappers', ['groupinfo'], unique=False)
op.create_index(op.f('ix_nu_outbound_wrappers_seriesname'), 'nu_outbound_wrappers', ['seriesname'], unique=False)
op.drop_index('ix_nu_outbound_wrappers_container_page', table_name='nu_outbound_wrappers')
op.drop_index('ix_nu_outbound_wrappers_link_url', table_name='nu_outbound_wrappers')
op.drop_column('nu_outbound_wrappers', 'container_page')
op.drop_column('nu_outbound_wrappers', 'link_url')
op.drop_column('nu_outbound_wrappers', 'target_url')
### end Alembic commands ###
示例10: downgrade
# 需要导入模块: from alembic import op [as 别名]
# 或者: from alembic.op import drop_index [as 别名]
def downgrade():
### commands auto generated by Alembic - please adjust! ###
op.add_column('nu_outbound_wrappers', sa.Column('target_url', sa.TEXT(), autoincrement=False, nullable=True))
op.add_column('nu_outbound_wrappers', sa.Column('link_url', sa.TEXT(), autoincrement=False, nullable=True))
op.add_column('nu_outbound_wrappers', sa.Column('container_page', sa.TEXT(), autoincrement=False, nullable=True))
op.create_index('ix_nu_outbound_wrappers_link_url', 'nu_outbound_wrappers', ['link_url'], unique=False)
op.create_index('ix_nu_outbound_wrappers_container_page', 'nu_outbound_wrappers', ['container_page'], unique=False)
op.drop_index(op.f('ix_nu_outbound_wrappers_seriesname'), table_name='nu_outbound_wrappers')
op.drop_index(op.f('ix_nu_outbound_wrappers_groupinfo'), table_name='nu_outbound_wrappers')
op.drop_index(op.f('ix_nu_outbound_wrappers_client_key'), table_name='nu_outbound_wrappers')
op.drop_index(op.f('ix_nu_outbound_wrappers_client_id'), table_name='nu_outbound_wrappers')
op.drop_column('nu_outbound_wrappers', 'seriesname')
op.drop_column('nu_outbound_wrappers', 'releaseinfo')
op.drop_column('nu_outbound_wrappers', 'referrer')
op.drop_column('nu_outbound_wrappers', 'outbound_wrapper')
op.drop_column('nu_outbound_wrappers', 'groupinfo')
op.drop_column('nu_outbound_wrappers', 'client_key')
op.drop_column('nu_outbound_wrappers', 'client_id')
op.drop_column('nu_outbound_wrappers', 'actual_target')
### end Alembic commands ###
示例11: downgrade
# 需要导入模块: from alembic import op [as 别名]
# 或者: from alembic.op import drop_index [as 别名]
def downgrade():
### commands auto generated by Alembic - please adjust! ###
op.drop_index(op.f('ix_web_pages_version_url'), table_name='web_pages_version')
op.drop_index(op.f('ix_web_pages_version_type'), table_name='web_pages_version')
op.drop_index('ix_web_pages_version_tsv_content', table_name='web_pages_version')
op.drop_index(op.f('ix_web_pages_version_transaction_id'), table_name='web_pages_version')
op.drop_index(op.f('ix_web_pages_version_state'), table_name='web_pages_version')
op.drop_index(op.f('ix_web_pages_version_priority'), table_name='web_pages_version')
op.drop_index(op.f('ix_web_pages_version_operation_type'), table_name='web_pages_version')
op.drop_index(op.f('ix_web_pages_version_netloc'), table_name='web_pages_version')
op.drop_index(op.f('ix_web_pages_version_ignoreuntiltime'), table_name='web_pages_version')
op.drop_index(op.f('ix_web_pages_version_id'), table_name='web_pages_version')
op.drop_index(op.f('ix_web_pages_version_end_transaction_id'), table_name='web_pages_version')
op.drop_index(op.f('ix_web_pages_version_distance'), table_name='web_pages_version')
op.drop_table('web_pages_version')
op.drop_table('transaction')
### end Alembic commands ###
示例12: upgrade
# 需要导入模块: from alembic import op [as 别名]
# 或者: from alembic.op import drop_index [as 别名]
def upgrade():
### commands auto generated by Alembic - please adjust! ###
op.add_column('rss_parser_feed_name_lut', sa.Column('feed_id', sa.BigInteger(), nullable=False))
op.create_index(op.f('ix_rss_parser_feed_name_lut_feed_id'), 'rss_parser_feed_name_lut', ['feed_id'], unique=False)
op.drop_index('ix_rss_parser_feed_name_lut_feed_name', table_name='rss_parser_feed_name_lut')
op.drop_constraint('rss_parser_feed_name_lut_feed_netloc_feed_name_key', 'rss_parser_feed_name_lut', type_='unique')
op.create_unique_constraint(None, 'rss_parser_feed_name_lut', ['feed_netloc', 'feed_id'])
op.drop_constraint('rss_parser_feed_name_lut_feed_name_fkey', 'rss_parser_feed_name_lut', type_='foreignkey')
op.create_foreign_key(None, 'rss_parser_feed_name_lut', 'rss_parser_funcs', ['feed_id'], ['id'])
op.drop_column('rss_parser_feed_name_lut', 'feed_name')
op.add_column('rss_parser_feed_name_lut_version', sa.Column('feed_id', sa.BigInteger(), autoincrement=False, nullable=True))
op.create_index(op.f('ix_rss_parser_feed_name_lut_version_feed_id'), 'rss_parser_feed_name_lut_version', ['feed_id'], unique=False)
op.drop_index('ix_rss_parser_feed_name_lut_version_feed_name', table_name='rss_parser_feed_name_lut_version')
op.drop_column('rss_parser_feed_name_lut_version', 'feed_name')
op.alter_column('rss_parser_funcs', 'func',
existing_type=sa.TEXT(),
nullable=True)
### end Alembic commands ###
示例13: downgrade
# 需要导入模块: from alembic import op [as 别名]
# 或者: from alembic.op import drop_index [as 别名]
def downgrade():
### commands auto generated by Alembic - please adjust! ###
op.alter_column('rss_parser_funcs', 'func',
existing_type=sa.TEXT(),
nullable=False)
op.add_column('rss_parser_feed_name_lut_version', sa.Column('feed_name', sa.TEXT(), autoincrement=False, nullable=True))
op.create_index('ix_rss_parser_feed_name_lut_version_feed_name', 'rss_parser_feed_name_lut_version', ['feed_name'], unique=False)
op.drop_index(op.f('ix_rss_parser_feed_name_lut_version_feed_id'), table_name='rss_parser_feed_name_lut_version')
op.drop_column('rss_parser_feed_name_lut_version', 'feed_id')
op.add_column('rss_parser_feed_name_lut', sa.Column('feed_name', sa.TEXT(), autoincrement=False, nullable=False))
op.drop_constraint(None, 'rss_parser_feed_name_lut', type_='foreignkey')
op.create_foreign_key('rss_parser_feed_name_lut_feed_name_fkey', 'rss_parser_feed_name_lut', 'rss_parser_funcs', ['feed_name'], ['feed_name'])
op.drop_constraint(None, 'rss_parser_feed_name_lut', type_='unique')
op.create_unique_constraint('rss_parser_feed_name_lut_feed_netloc_feed_name_key', 'rss_parser_feed_name_lut', ['feed_netloc', 'feed_name'])
op.create_index('ix_rss_parser_feed_name_lut_feed_name', 'rss_parser_feed_name_lut', ['feed_name'], unique=False)
op.drop_index(op.f('ix_rss_parser_feed_name_lut_feed_id'), table_name='rss_parser_feed_name_lut')
op.drop_column('rss_parser_feed_name_lut', 'feed_id')
### end Alembic commands ###
示例14: downgrade
# 需要导入模块: from alembic import op [as 别名]
# 或者: from alembic.op import drop_index [as 别名]
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_column('user', 'primary_blockchain_address')
op.drop_column('user', 'is_public')
op.add_column('transfer_account', sa.Column('balance', sa.BIGINT(), autoincrement=False, nullable=True))
op.drop_constraint(None, 'transfer_account', type_='foreignkey')
op.drop_column('transfer_account', 'is_public')
op.drop_column('transfer_account', 'exchange_contract_id')
op.drop_column('transfer_account', '_balance_wei')
op.drop_column('email_whitelist', 'is_public')
op.add_column('credit_transfer', sa.Column('transfer_amount', sa.INTEGER(), autoincrement=False, nullable=True))
op.drop_column('credit_transfer', 'is_public')
op.drop_column('credit_transfer', '_transfer_amount_wei')
op.drop_column('blockchain_address', 'is_public')
op.drop_table('exchange_contract_token_association_table')
op.drop_index(op.f('ix_exchange_contract_contract_registry_blockchain_address'), table_name='exchange_contract')
op.drop_index(op.f('ix_exchange_contract_blockchain_address'), table_name='exchange_contract')
op.drop_table('exchange_contract')
op.drop_table('exchange')
# ### end Alembic commands ###
示例15: downgrade
# 需要导入模块: from alembic import op [as 别名]
# 或者: from alembic.op import drop_index [as 别名]
def downgrade():
op.create_table(
"project_members",
sa.Column("user_id", sa.INTEGER(), autoincrement=False, nullable=True),
sa.Column("project_id", sa.INTEGER(), autoincrement=False, nullable=True),
sa.Column(
"date_joined", postgresql.TIMESTAMP(), autoincrement=False, nullable=True
),
sa.Column("is_lead", sa.BOOLEAN(), autoincrement=False, nullable=False),
sa.ForeignKeyConstraint(
["project_id"], ["projects.id"], name="project_members_project_id_fkey"
),
sa.ForeignKeyConstraint(
["user_id"], ["users.id"], name="project_members_user_id_fkey"
),
)
op.drop_index(
op.f("ix_project_memberships_is_lead"), table_name="project_memberships"
)
op.drop_table("project_memberships")