Python alembic.op.drop_constraint() Examples
The following are 30
code examples of alembic.op.drop_constraint().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
alembic.op
, or try the search function
.
Example #1
Source File: 2020_052419_f680032cc361_.py From app with MIT License | 6 votes |
def upgrade(): # ### commands auto generated by Alembic - please adjust! ### op.create_table('fido', sa.Column('id', sa.Integer(), autoincrement=True, nullable=False), sa.Column('created_at', sqlalchemy_utils.types.arrow.ArrowType(), nullable=False), sa.Column('updated_at', sqlalchemy_utils.types.arrow.ArrowType(), nullable=True), sa.Column('credential_id', sa.String(), nullable=False), sa.Column('uuid', sa.String(), nullable=False), sa.Column('public_key', sa.String(), nullable=False), sa.Column('sign_count', sa.Integer(), nullable=False), sa.Column('name', sa.String(length=128), nullable=False), sa.ForeignKeyConstraint(['uuid'], ['users.fido_uuid'], ondelete='cascade'), sa.PrimaryKeyConstraint('id'), sa.UniqueConstraint('public_key') ) op.create_index(op.f('ix_fido_credential_id'), 'fido', ['credential_id'], unique=True) op.drop_constraint('users_fido_credential_id_key', 'users', type_='unique') op.drop_constraint('users_fido_pk_key', 'users', type_='unique') op.drop_column('users', 'fido_sign_count') op.drop_column('users', 'fido_pk') op.drop_column('users', 'fido_credential_id') # ### end Alembic commands ###
Example #2
Source File: 61ac23e35f86_fix_pr_project_from_key.py From pagure with GNU General Public License v2.0 | 6 votes |
def downgrade(): """ Alter the pull_requests table to update the foreign key to cascade on delete. """ op.drop_constraint( 'pull_requests_project_id_from_fkey', 'pull_requests', type_='foreignkey') op.create_foreign_key( name='pull_requests_project_id_from_fkey', source_table='pull_requests', referent_table='projects', local_cols=['project_id_from'], remote_cols=['id'], onupdate='cascade', ondelete='cascade', )
Example #3
Source File: 61ac23e35f86_fix_pr_project_from_key.py From pagure with GNU General Public License v2.0 | 6 votes |
def upgrade(): """ Alter the pull_requests table to update the foreign key to set null on delete. """ op.drop_constraint( 'pull_requests_project_id_from_fkey', 'pull_requests', type_='foreignkey') op.create_foreign_key( name='pull_requests_project_id_from_fkey', source_table='pull_requests', referent_table='projects', local_cols=['project_id_from'], remote_cols=['id'], onupdate='cascade', ondelete='set null', )
Example #4
Source File: 19e8725e0581_.py From gitlab-tools with GNU General Public License v3.0 | 6 votes |
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 ###
Example #5
Source File: d4841aeeb072_.py From gitlab-tools with GNU General Public License v3.0 | 6 votes |
def downgrade(): # ### commands auto generated by Alembic - please adjust! ### op.add_column('task_result', sa.Column('traceback', sa.TEXT(), autoincrement=False, nullable=True)) op.add_column('task_result', sa.Column('task_id', sa.VARCHAR(length=155), autoincrement=False, nullable=True)) op.add_column('task_result', sa.Column('date_done', postgresql.TIMESTAMP(), autoincrement=False, nullable=True)) op.add_column('task_result', sa.Column('status', sa.VARCHAR(length=50), autoincrement=False, nullable=True)) op.add_column('task_result', sa.Column('result', postgresql.BYTEA(), autoincrement=False, nullable=True)) op.drop_constraint(None, 'task_result', type_='foreignkey') op.create_unique_constraint('task_result_task_id_key', 'task_result', ['task_id']) op.drop_index(op.f('ix_task_result_celery_taskmeta_id'), table_name='task_result') op.drop_column('task_result', 'celery_taskmeta_id') op.drop_table('celery_tasksetmeta') op.drop_table('celery_taskmeta') # ### end Alembic commands ###
Example #6
Source File: 9a91532c8534_add_scaling_group.py From backend.ai-manager with GNU Lesser General Public License v3.0 | 6 votes |
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 ###
Example #7
Source File: 854bd902b1bc_change_kernel_identification.py From backend.ai-manager with GNU Lesser General Public License v3.0 | 6 votes |
def upgrade(): 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.add_column('kernels', sa.Column('id', GUID(), server_default=sa.text('uuid_generate_v4()'), nullable=False)) op.add_column('kernels', sa.Column('role', sa.String(length=16), nullable=False, default='master')) op.create_primary_key('pk_kernels', 'kernels', ['id']) op.alter_column( 'kernels', 'sess_id', existing_type=postgresql.UUID(), type_=sa.String(length=64), nullable=True, existing_server_default=sa.text('uuid_generate_v4()')) op.create_index(op.f('ix_kernels_sess_id'), 'kernels', ['sess_id'], unique=False) op.create_index(op.f('ix_kernels_sess_id_role'), 'kernels', ['sess_id', 'role'], unique=False) op.create_foreign_key('fk_vfolder_attachment_vfolder_vfolders', 'vfolder_attachment', 'vfolders', ['vfolder'], ['id'], onupdate='CASCADE', ondelete='CASCADE') op.create_foreign_key('fk_vfolder_attachment_kernel_kernels', 'vfolder_attachment', 'kernels', ['kernel'], ['id'], onupdate='CASCADE', ondelete='CASCADE')
Example #8
Source File: a54c57ada3f5_removes_useless_indexes.py From gnocchi with Apache License 2.0 | 6 votes |
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")
Example #9
Source File: 00027_c92e0c8632d7_more_rss_stuff.py From ReadableWebProxy with BSD 3-Clause "New" or "Revised" License | 6 votes |
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 ###
Example #10
Source File: 00027_c92e0c8632d7_more_rss_stuff.py From ReadableWebProxy with BSD 3-Clause "New" or "Revised" License | 6 votes |
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 ###
Example #11
Source File: ed9c6ddc5c35_fix_host_foreign_key.py From gnocchi with Apache License 2.0 | 6 votes |
def upgrade(): conn = op.get_bind() insp = inspect(conn) fk_names = [fk['name'] for fk in insp.get_foreign_keys('host')] if ("fk_hypervisor_id_resource_id" not in fk_names and "fk_host_id_resource_id" in fk_names): # NOTE(sileht): we are already good, the BD have been created from # scratch after "a54c57ada3f5" return op.drop_constraint("fk_hypervisor_id_resource_id", "host", type_="foreignkey") op.drop_constraint("fk_hypervisor_history_resource_history_revision", "host_history", type_="foreignkey") op.create_foreign_key("fk_host_id_resource_id", "host", "resource", ["id"], ["id"], ondelete="CASCADE") op.create_foreign_key("fk_host_history_resource_history_revision", "host_history", "resource_history", ["revision"], ["revision"], ondelete="CASCADE")
Example #12
Source File: 2019-09-08_c225ea8fbf5e_add_hash_and_parent_hash_columns.py From ReadableWebProxy with BSD 3-Clause "New" or "Revised" License | 6 votes |
def downgrade(): # ### commands auto generated by Alembic - please adjust! ### op.add_column('web_pages_version', sa.Column('is_delta', sa.BOOLEAN(), autoincrement=False, nullable=True)) op.drop_constraint(None, 'web_pages_version', type_='foreignkey') op.drop_column('web_pages_version', 'parent_hash') op.drop_column('web_pages_version', 'data_hash') op.add_column('rss_parser_funcs_version', sa.Column('is_delta', sa.BOOLEAN(), autoincrement=False, nullable=True)) op.drop_constraint(None, 'rss_parser_funcs_version', type_='foreignkey') op.drop_column('rss_parser_funcs_version', 'parent_hash') op.drop_column('rss_parser_funcs_version', 'data_hash') op.add_column('rss_parser_feed_name_lut_version', sa.Column('is_delta', sa.BOOLEAN(), autoincrement=False, nullable=True)) op.drop_constraint(None, 'rss_parser_feed_name_lut_version', type_='foreignkey') op.drop_column('rss_parser_feed_name_lut_version', 'parent_hash') op.drop_column('rss_parser_feed_name_lut_version', 'data_hash') op.add_column('raw_web_pages_version', sa.Column('is_delta', sa.BOOLEAN(), autoincrement=False, nullable=True)) op.drop_constraint(None, 'raw_web_pages_version', type_='foreignkey') op.drop_column('raw_web_pages_version', 'parent_hash') op.drop_column('raw_web_pages_version', 'data_hash') # ### end Alembic commands ###
Example #13
Source File: 00009_8af5f324577a_fiddling_with_uniqueness.py From ReadableWebProxy with BSD 3-Clause "New" or "Revised" License | 5 votes |
def upgrade(): ### commands auto generated by Alembic - please adjust! ### op.drop_constraint('nu_outbound_wrappers_client_id_client_key_seriesname_releas_key', 'nu_outbound_wrappers', type_='unique') op.create_unique_constraint(None, 'nu_outbound_wrappers', ['client_id', 'client_key', 'seriesname', 'releaseinfo', 'groupinfo', 'actual_target']) ### end Alembic commands ###
Example #14
Source File: 1a852ec3bc90_.py From SempoBlockchain with GNU General Public License v3.0 | 5 votes |
def downgrade(): # ### commands auto generated by Alembic - please adjust! ### op.drop_constraint(None, 'user', type_='foreignkey') op.drop_column('user', 'default_transfer_account_id') # ### end Alembic commands ###
Example #15
Source File: 00028_9d03d8bba40e_moarrrrrrrrrrr_rss_stuff.py From ReadableWebProxy with BSD 3-Clause "New" or "Revised" License | 5 votes |
def downgrade(): ### commands auto generated by Alembic - please adjust! ### op.drop_constraint(None, 'feed_pages', type_='foreignkey') op.drop_index(op.f('ix_feed_pages_feed_id'), table_name='feed_pages') op.drop_column('feed_pages', 'feed_id') ### end Alembic commands ###
Example #16
Source File: 00008_bb9d84530f05_.py From ReadableWebProxy with BSD 3-Clause "New" or "Revised" License | 5 votes |
def downgrade(): ### commands auto generated by Alembic - please adjust! ### op.drop_constraint(None, 'nu_outbound_wrappers', type_='unique') ### end Alembic commands ###
Example #17
Source File: 00009_8af5f324577a_fiddling_with_uniqueness.py From ReadableWebProxy with BSD 3-Clause "New" or "Revised" License | 5 votes |
def downgrade(): ### commands auto generated by Alembic - please adjust! ### op.drop_constraint(None, 'nu_outbound_wrappers', type_='unique') op.create_unique_constraint('nu_outbound_wrappers_client_id_client_key_seriesname_releas_key', 'nu_outbound_wrappers', ['client_id', 'client_key', 'seriesname', 'releaseinfo', 'groupinfo']) ### end Alembic commands ###
Example #18
Source File: 46df6466b8fa_drop_pull_request_check.py From pagure with GNU General Public License v2.0 | 5 votes |
def upgrade(): """ Drop the pull_request_check constraint. """ connection = op.get_bind() connection.begin_nested() try: op.drop_constraint("pull_requests_check", "pull_requests") except sa.exc.ProgrammingError: connection.connection.connection.rollback() print( 'Ignoring the pull_requests_check ' 'constraint if it does not exist')
Example #19
Source File: 2b1743f77436_cascade_deleting_flags_when_tokens_are_.py From pagure with GNU General Public License v2.0 | 5 votes |
def downgrade(): """ Remove the existing foreign key in pull_request_flags.token_id and re-create it with without specifying the behavior on delete and update. """ op.drop_constraint( 'pull_request_flags_token_id_fkey', 'pull_request_flags', type_='foreignkey') op.create_foreign_key( u'pull_request_flags_token_id_fkey', 'pull_request_flags', 'tokens', ['token_id'], ['id'], )
Example #20
Source File: 802047d28f89_drop_unique_constraint_on_commit_uid.py From pagure with GNU General Public License v2.0 | 5 votes |
def upgrade(): """ Remove the constraint named: commit_flags_uid_key, pass otherwise. """ try: op.drop_constraint('commit_flags_uid_key', 'commit_flags') except: pass
Example #21
Source File: 6c1c070f3663_.py From FXTest with MIT License | 5 votes |
def downgrade(): # ### commands auto generated by Alembic - please adjust! ### op.drop_constraint(None, 'users', type_='foreignkey') op.drop_constraint(None, 'tstresults', type_='foreignkey') op.add_column('tasks', sa.Column('taskdesc', sa.TEXT(length=252), nullable=True)) op.drop_constraint(None, 'tasks', type_='foreignkey') op.drop_constraint(None, 'tasks', type_='foreignkey') op.drop_constraint(None, 'projects', type_='unique') op.drop_constraint(None, 'interfacetests', type_='foreignkey') op.drop_table('userloginlog') # ### end Alembic commands ###
Example #22
Source File: 59e5df6a489_.py From beavy with Mozilla Public License 2.0 | 5 votes |
def downgrade(): ### commands auto generated by Alembic - please adjust! ### op.drop_constraint(None, 'objects', type_='foreignkey') op.drop_column('objects', 'in_reply_to_id') ### end Alembic commands ###
Example #23
Source File: 01e58ee9eccb_adjust_constraints_on_pull_request_flags.py From pagure with GNU General Public License v2.0 | 5 votes |
def downgrade(): """ Remove the composite unique constraints on UID + pull_request_uid in pull_request_flags and make it an unique constraint on UID . """ op.drop_constraint( 'pull_request_flags_uid_pull_request_uid_key', 'pull_request_flags') op.create_unique_constraint( "pull_request_flags_uid_key", 'pull_request_flags', ["uid"] )
Example #24
Source File: bae1a7326e8a_add_domain_model.py From backend.ai-manager with GNU Lesser General Public License v3.0 | 5 votes |
def downgrade(): op.drop_constraint(op.f('fk_users_domain_name_domains'), 'users', type_='foreignkey') op.drop_index(op.f('ix_users_domain_name'), table_name='users') op.drop_column('users', 'domain_name') op.drop_table('domains')
Example #25
Source File: 01e58ee9eccb_adjust_constraints_on_pull_request_flags.py From pagure with GNU General Public License v2.0 | 5 votes |
def upgrade(): """ Remove the unique constraints on UID in pull_request_flags and make it a composite unique constraint on UID + pull_request_uid. """ # alter the constraints op.drop_constraint('pull_request_flags_uid_key', 'pull_request_flags') op.create_unique_constraint( "pull_request_flags_uid_pull_request_uid_key", 'pull_request_flags', ["uid", "pull_request_uid"] )
Example #26
Source File: 819c2b3830a9_add_user_model.py From backend.ai-manager with GNU Lesser General Public License v3.0 | 5 votes |
def downgrade(): # ### commands auto generated by Alembic - please adjust! ### op.drop_constraint(op.f('fk_keypairs_user_users'), 'keypairs', type_='foreignkey') op.drop_column('keypairs', 'user') op.drop_index(op.f('ix_users_email'), table_name='users') op.drop_table('users') # ### end Alembic commands ### userrole.drop(op.get_bind())
Example #27
Source File: 7ea324d0535b_vfolder_and_kernel.py From backend.ai-manager with GNU Lesser General Public License v3.0 | 5 votes |
def downgrade(): # ### commands auto generated by Alembic - please adjust! ### op.add_column('kernels', sa.Column('agent_id', sa.VARCHAR(), autoincrement=False, nullable=True)) op.drop_constraint(op.f('fk_kernels_agent_agents'), 'kernels', type_='foreignkey') op.drop_index(op.f('ix_kernels_terminated_at'), table_name='kernels') op.drop_index(op.f('ix_kernels_status'), table_name='kernels') op.drop_index(op.f('ix_kernels_created_at'), table_name='kernels') op.drop_column('kernels', 'status_info') op.drop_column('kernels', 'num_queries') op.drop_column('kernels', 'net_tx_bytes') op.drop_column('kernels', 'net_rx_bytes') op.drop_column('kernels', 'max_mem_bytes') op.drop_column('kernels', 'io_write_bytes') op.drop_column('kernels', 'io_read_bytes') op.drop_column('kernels', 'cur_mem_bytes') op.drop_column('kernels', 'cpu_used') op.drop_column('kernels', 'allocated_cores') op.drop_column('kernels', 'agent') op.create_table( 'usage', sa.Column('id', postgresql.UUID(), server_default=sa.text('uuid_generate_v4()'), autoincrement=False, nullable=False), sa.Column('access_key_id', sa.VARCHAR(length=20), autoincrement=False, nullable=True), sa.Column('kernel_type', sa.VARCHAR(), autoincrement=False, nullable=True), sa.Column('kernel_id', sa.VARCHAR(), autoincrement=False, nullable=True), sa.Column('started_at', postgresql.TIMESTAMP(timezone=True), autoincrement=False, nullable=True), sa.Column('terminated_at', postgresql.TIMESTAMP(timezone=True), autoincrement=False, nullable=True), sa.Column('cpu_used', sa.INTEGER(), server_default=sa.text('0'), autoincrement=False, nullable=True), sa.Column('mem_used', sa.INTEGER(), server_default=sa.text('0'), autoincrement=False, nullable=True), sa.Column('io_used', sa.INTEGER(), server_default=sa.text('0'), autoincrement=False, nullable=True), sa.Column('net_used', sa.INTEGER(), server_default=sa.text('0'), autoincrement=False, nullable=True), sa.ForeignKeyConstraint(['access_key_id'], ['keypairs.access_key'], name='fk_usage_access_key_id_keypairs'), sa.PrimaryKeyConstraint('id', name='pk_usage') ) op.drop_table('vfolder_attachment') op.drop_table('vfolders') op.drop_table('agents') # ### end Alembic commands ###
Example #28
Source File: dbc1e053b880_add_keypair_resource_policy.py From backend.ai-manager with GNU Lesser General Public License v3.0 | 5 votes |
def downgrade(): # ### commands auto generated by Alembic - please adjust! ### op.drop_constraint(op.f('fk_keypairs_resource_policy_keypair_resource_policies'), 'keypairs', type_='foreignkey') op.add_column( 'keypairs', sa.Column('concurrency_limit', sa.INTEGER(), autoincrement=False, nullable=True)) op.alter_column('keypairs', 'resource_policy', existing_type=sa.String(length=256), type_=sa.VARCHAR(), nullable=True) op.drop_table('keypair_resource_policies') default_for_unspecified.drop(op.get_bind()) # ### end Alembic commands ###
Example #29
Source File: c5e4e764f9e3_add_domain_group_user_fields_to_kernels.py From backend.ai-manager with GNU Lesser General Public License v3.0 | 5 votes |
def downgrade(): # ### commands auto generated by Alembic - please adjust! ### op.drop_constraint(op.f('fk_kernels_domain_name_domains'), 'kernels', type_='foreignkey') op.drop_constraint(op.f('fk_kernels_user_uuid_users'), 'kernels', type_='foreignkey') op.drop_constraint(op.f('fk_kernels_group_id_groups'), 'kernels', type_='foreignkey') op.drop_column('kernels', 'user_uuid') op.drop_column('kernels', 'group_id') op.drop_column('kernels', 'domain_name') # ### end Alembic commands ###
Example #30
Source File: 854bd902b1bc_change_kernel_identification.py From backend.ai-manager with GNU Lesser General Public License v3.0 | 5 votes |
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'])