我们从Python开源项目中,提取了以下50个代码示例,用于说明如何使用alembic.op.drop_constraint()。
def upgrade(): op.execute(sa.schema.CreateSequence(sa.Sequence('pod_states_id_seq'))) op.add_column('pod_states', sa.Column('id', sa.Integer(), nullable=False, server_default=sa.text("nextval('pod_states_id_seq'::regclass)"))) op.execute("ALTER TABLE pod_states DROP CONSTRAINT pod_states_pkey, " "ADD CONSTRAINT pod_states_pkey PRIMARY KEY (id);") op.add_column('container_states', sa.Column('exit_code', sa.Integer(), nullable=True)) op.add_column('container_states', sa.Column('pod_state_id', sa.Integer(), nullable=True)) op.add_column('container_states', sa.Column('reason', sa.Text(), nullable=True)) op.create_index('ix_pod_id_start_time', 'pod_states', ['pod_id', 'start_time'], unique=True) op.create_foreign_key('container_states_pod_state_id_fkey', 'container_states', 'pod_states', ['pod_state_id'], ['id']) upgrade_data() op.alter_column('container_states', 'pod_state_id', existing_type=sa.INTEGER(), nullable=False) op.drop_constraint(u'container_states_pod_id_fkey', 'container_states', type_='foreignkey') op.drop_column('container_states', 'pod_id')
def downgrade(): op.add_column('container_states', sa.Column('pod_id', postgresql.UUID(), autoincrement=False, nullable=True)) op.create_foreign_key(u'container_states_pod_id_fkey', 'container_states', 'pods', ['pod_id'], ['id']) downgrade_data() op.drop_column('container_states', 'reason') op.drop_column('container_states', 'exit_code') op.drop_constraint('container_states_pod_state_id_fkey', 'container_states', type_='foreignkey') op.drop_index('ix_pod_id_start_time', table_name='pod_states') op.drop_column('container_states', 'pod_state_id') op.execute("ALTER TABLE pod_states DROP CONSTRAINT pod_states_pkey, " "ADD CONSTRAINT pod_states_pkey PRIMARY KEY (pod_id, start_time);") op.drop_column('pod_states', 'id') op.execute(sa.schema.DropSequence(sa.Sequence('pod_states_id_seq')))
def upgrade(): op.alter_column('kubes', 'name', existing_type=sa.VARCHAR(length=64), nullable=False) op.create_index('one_default', 'kubes', ['is_default'], unique=True, postgresql_where=sa.text(u'kubes.is_default IS true')) op.drop_constraint(u'kubes_is_default_key', 'kubes', type_='unique') op.alter_column('packages', 'name', existing_type=sa.VARCHAR(length=64), nullable=False) op.alter_column('packages', 'prefix', existing_type=sa.VARCHAR(), nullable=False) op.alter_column('packages', 'suffix', existing_type=sa.VARCHAR(), nullable=False) session = Session(bind=op.get_bind()) session.query(PackageKube).filter(sa.or_( PackageKube.package_id.is_(None), PackageKube.kube_id.is_(None), )).delete() session.commit() op.alter_column('package_kube', 'kube_id', existing_type=sa.INTEGER(), nullable=False) op.alter_column('package_kube', 'package_id', existing_type=sa.INTEGER(), nullable=False)
def upgrade(): ### commands auto generated by Alembic - please adjust! ### op.create_table('menuitem_roles', sa.Column('id', sa.Integer(), nullable=False), sa.Column('menuitem_id', sa.Integer(), nullable=True), sa.Column('role_id', sa.Integer(), nullable=True), sa.ForeignKeyConstraint(['menuitem_id'], ['menus_items.id'], ), sa.ForeignKeyConstraint(['role_id'], ['rbac_role.id'], ), sa.PrimaryKeyConstraint('id') ) op.drop_constraint(u'menus_created_by_id_fkey', 'menus', type_='foreignkey') op.drop_column('menus', 'created_by_id') op.drop_column('menus', 'ts') op.drop_constraint(u'menus_items_created_by_id_fkey', 'menus_items', type_='foreignkey') op.drop_constraint(u'menus_items_page_id_fkey', 'menus_items', type_='foreignkey') op.drop_column('menus_items', 'created_by_id') op.drop_column('menus_items', 'is_group_label') op.drop_column('menus_items', 'page_id') op.drop_column('menus_items', 'roles') op.drop_column('menus_items', 'ts') op.drop_column('menus_items', 'is_public') op.drop_table('pages') ### end Alembic commands ###
def downgrade(): # ### commands auto generated by Alembic - please adjust! ### op.drop_constraint(None, 'mailing_list', type_='unique') op.drop_column('mailing_list', 'url') op.create_table('email', sa.Column('id', sa.INTEGER(), server_default=sa.text(u"nextval('email_id_seq'::regclass)"), nullable=False), sa.Column('value', sa.VARCHAR(length=120), autoincrement=False, nullable=True), sa.PrimaryKeyConstraint('id', name=u'email_pkey'), sa.UniqueConstraint('value', name=u'email_value_key'), postgresql_ignore_search_path=False ) op.create_table('email_mailing_list', sa.Column('mailing_list_id', sa.INTEGER(), autoincrement=False, nullable=True), sa.Column('email_id', sa.INTEGER(), autoincrement=False, nullable=True), sa.ForeignKeyConstraint(['email_id'], [u'email.id'], name=u'email_mailing_list_email_id_fkey'), sa.ForeignKeyConstraint(['mailing_list_id'], [u'mailing_list.id'], name=u'email_mailing_list_mailing_list_id_fkey') ) # ### end Alembic commands ###
def downgrade(): # Drop trigger op.execute( 'DROP TRIGGER increment_num_rows_in_db_array ON callset_to_db_array_association CASCADE') op.drop_column(u'db_array', 'num_rows') op.create_table( 'db_row', sa.Column('id', sa.BIGINT(), nullable=False), sa.Column('db_array_id', sa.BIGINT(), autoincrement=False, nullable=False), sa.Column('tile_row_id', sa.BIGINT(), autoincrement=False, nullable=False), sa.ForeignKeyConstraint(['db_array_id'],[u'db_array.id'], name=u'db_row_db_array_id_fkey'), sa.PrimaryKeyConstraint('id', name=u'db_row_pkey')) op.add_column( u'callset', sa.Column('individual_id', sa.BIGINT(), autoincrement=False, nullable=False)) op.add_column(u'callset', sa.Column('dbrow_id', sa.BIGINT(), autoincrement=False, nullable=False)) op.drop_constraint('callset_source_sample_id_fkey','callset', type_='foreignkey') op.drop_constraint('callset_target_sample_id_fkey','callset', type_='foreignkey') op.create_foreign_key(u'callset_individual_id_fkey','callset', 'individual', ['individual_id'], ['id']) op.create_foreign_key(u'callset_dbrow_id_fkey','callset', 'db_row', ['dbrow_id'], ['id']) op.drop_column(u'callset', 'target_sample_id') op.drop_column(u'callset', 'source_sample_id') op.drop_index('db_array_id_tile_row_id_idx',table_name='callset_to_db_array_association') op.drop_table('callset_to_db_array_association') op.drop_table('sample')
def upgrade(): # When making changes to a column that has a foreign key, we need to drop # and then re-add the constraint op.execute('DELETE FROM txn_reconciles WHERE txn_id IS NULL;') op.execute('LOCK TABLES txn_reconciles WRITE, transactions WRITE;') op.drop_constraint('fk_txn_reconciles_txn_id_transactions', 'txn_reconciles', type_='foreignkey') op.alter_column( 'txn_reconciles', 'txn_id', existing_type=mysql.INTEGER(display_width=11), nullable=False ) op.create_foreign_key('fk_txn_reconciles_txn_id_transactions', 'txn_reconciles', 'transactions', ['txn_id'], ['id']) op.execute('UNLOCK TABLES;')
def upgrade(): ### commands auto generated by Alembic - please adjust! ### op.add_column('comments', sa.Column('goodsID', sa.Integer(), nullable=True)) op.alter_column('comments', 'commentatorID', existing_type=mysql.INTEGER(display_width=11), nullable=True) op.drop_constraint('comments_ibfk_2', 'comments', type_='foreignkey') op.create_foreign_key(None, 'comments', 'goods', ['goodsID'], ['goodID']) op.drop_column('comments', 'goodID') op.add_column('goods', sa.Column('address', sa.String(length=128), nullable=False)) op.add_column('goods', sa.Column('poster', sa.String(length=128), nullable=False)) op.add_column('goods', sa.Column('times', sa.Integer(), nullable=True)) op.alter_column('orders', 'createDate', existing_type=mysql.DATETIME(), nullable=False) ### end Alembic commands ###
def downgrade(): ### commands auto generated by Alembic - please adjust! ### op.alter_column('orders', 'createDate', existing_type=mysql.DATETIME(), nullable=True) op.drop_column('goods', 'times') op.drop_column('goods', 'poster') op.drop_column('goods', 'address') op.add_column('comments', sa.Column('goodID', mysql.INTEGER(display_width=11), autoincrement=False, nullable=False)) op.drop_constraint(None, 'comments', type_='foreignkey') op.create_foreign_key('comments_ibfk_2', 'comments', 'goods', ['goodID'], ['goodID']) op.alter_column('comments', 'commentatorID', existing_type=mysql.INTEGER(display_width=11), nullable=False) op.drop_column('comments', 'goodsID') ### end Alembic commands ###
def change_inheriting_table(self, table_name, old_id_column_name, parent_table_name): """Tables of classes that inherit from other classes (using joint table inheritance) named their primary key columns xxx_id (assuming the parent is called xxx here). These were also foreign keys to the primary key of the parent table. In our Declarative implementation we just always use the name `id` for a primary key regardless of the situation. This method renames such primary key columns, and deal with the knock-on effect of this change to related primary and foreign key as well. :arg table_name: The name of the table underlying the child/inheriting class. :arg old_id_column_name: The old name of the primary key column of the child/inheriting class. :arg parent_table_name: The name of the table underlying the parent class. """ self.schedule('drop_fk', op.drop_constraint, '%s_%s_fkey' % (table_name, old_id_column_name), table_name) self.rename_pk_column(table_name, old_id_column_name, 'id', ['id']) self.schedule('create_fk', op.create_foreign_key, fk_name(table_name, 'id', parent_table_name), table_name, parent_table_name, ['id'], ['id'], ondelete='CASCADE')
def rename_link_table(self): old_table_name = 'requirement_deferred_actions__deferredaction_requirements' new_table_name = 'deferredaction_requirement' # Rename table itself self.schedule('alter', op.rename_table, old_table_name, new_table_name) # Rename of foreign key names for old_name, other_table_name in [ ('deferredaction_requirements_fk', 'deferredaction'), ('requirement_deferred_actions_fk', 'requirement') ]: column_name = '%s_id' % other_table_name new_name = fk_name(new_table_name, column_name, other_table_name) self.schedule('drop_fk', op.drop_constraint, old_name, old_table_name) self.schedule('create_fk', op.create_foreign_key, new_name, new_table_name, other_table_name, [column_name], ['id']) # Primary keys are renamed according to new naming convention - in this case the table too self.rename_pk(new_table_name, ['deferredaction_id', 'requirement_id'], old_table_name=old_table_name)
def change_task(self): # Task in elixir did not generate a row_type for use as discriminator self.schedule('alter', op.add_column, 'task', Column('row_type', String(40))) # Task in elixir's queue_id was NULLABLE, but should not be (Tasks HAVE to be in a Queue now) self.schedule('alter', op.alter_column, 'task', 'queue_id', nullable=True) # Rename of relationship foreign key Task.reserved_by_id -> reserved_by_party_id old_name = 'reserved_by_id' new_name = 'reserved_by_party_id' self.schedule('drop_fk', op.drop_constraint, '%s_%s_fk' % ('task', old_name), 'task') self.schedule('alter', op.alter_column, 'task', old_name, new_column_name=new_name) self.schedule('create_fk', op.create_foreign_key, fk_name('task', new_name, 'party'), 'task', 'party', [new_name], ['id']) self.schedule('drop_pk', op.drop_index, ix_name('task', 'reserved_by_id')) self.schedule('indexes', op.create_index, ix_name('task','reserved_by_party_id'), 'task', ['reserved_by_party_id'])
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")
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")
def downgrade(): ### commands auto generated by Alembic - please adjust! ### op.create_table('issue', sa.Column('id', sa.INTEGER(), nullable=False), sa.Column('user_id', sa.INTEGER(), autoincrement=False, nullable=False), sa.Column('topic_id', sa.INTEGER(), autoincrement=False, nullable=False), sa.Column('serial', sa.INTEGER(), autoincrement=False, nullable=True), sa.Column('published_at', postgresql.TIMESTAMP(), autoincrement=False, nullable=True), sa.Column('created_at', postgresql.TIMESTAMP(), autoincrement=False, nullable=True), sa.Column('title', sa.VARCHAR(length=128), server_default=sa.text(u"''::character varying"), autoincrement=False, nullable=False), sa.ForeignKeyConstraint(['topic_id'], [u'topic.id'], name=u'fk_issue_topic'), sa.ForeignKeyConstraint(['user_id'], [u'user.id'], name=u'fk_issue_user'), sa.PrimaryKeyConstraint('id', name=u'issue_pkey'), sa.UniqueConstraint('topic_id', 'serial', name=u'ux_issue_topic_serial') ) op.add_column('link', sa.Column('issue_id', sa.INTEGER(), autoincrement=False, nullable=True)) op.drop_constraint('fk_link_topic', 'link', type_='foreignkey') op.create_foreign_key(u'fk_link_issue', 'link', 'issue', ['issue_id'], ['id']) op.create_index('ix_issue', 'link', ['issue_id'], unique=False) op.drop_column('link', 'topic_id') ### end Alembic commands ###
def upgrade(): """Upgrade the database to a newer revision.""" # ### commands auto generated by Alembic - please adjust! ### op.create_table('stacks', sa.Column('id', sa.Integer(), nullable=False), sa.Column('is_ref_stack', sa.Boolean(), nullable=False), sa.Column('stack_json', postgresql.JSONB(), nullable=False), sa.PrimaryKeyConstraint('id')) op.add_column('similar_stacks', sa.Column('analysis', postgresql.JSONB())) op.add_column('similar_stacks', sa.Column('similar_stack_id', sa.Integer(), nullable=False)) op.add_column('similar_stacks', sa.Column('similarity_value', sa.Float(), nullable=False)) op.add_column('similar_stacks', sa.Column('stack_id', sa.Integer(), nullable=False)) op.create_unique_constraint('sim_unique', 'similar_stacks', ['stack_id', 'similar_stack_id']) op.drop_constraint('similar_stacks_appstack_id_fkey', 'similar_stacks', type_='foreignkey') op.create_foreign_key(None, 'similar_stacks', 'stacks', ['stack_id'], ['id']) op.create_foreign_key(None, 'similar_stacks', 'stacks', ['similar_stack_id'], ['id']) op.drop_column('similar_stacks', 'dependency_list') op.drop_column('similar_stacks', 'appstack_id') op.drop_table('reference_stacks') op.drop_table('app_stacks') # ### end Alembic commands ###
def downgrade_rdr(): # ### commands auto generated by Alembic - please adjust! ### op.add_column(u'site', sa.Column('consortium_name', mysql.VARCHAR(length=255), nullable=False)) op.drop_constraint(None, 'site', type_='foreignkey') op.alter_column(u'site', 'hpo_id', existing_type=mysql.INTEGER(display_width=11), nullable=False) op.drop_column(u'site', 'zip_code') op.drop_column(u'site', 'state') op.drop_column(u'site', 'site_status') op.drop_column(u'site', 'physical_location_name') op.drop_column(u'site', 'phone_number') op.drop_column(u'site', 'organization_id') op.drop_column(u'site', 'notes') op.drop_column(u'site', 'longitude') op.drop_column(u'site', 'link') op.drop_column(u'site', 'launch_date') op.drop_column(u'site', 'latitude') op.drop_column(u'site', 'directions') op.drop_column(u'site', 'city') op.drop_column(u'site', 'admin_emails') op.drop_column(u'site', 'address_2') op.drop_column(u'site', 'address_1') op.drop_table('organization') # ### end Alembic commands ###
def upgrade(pyramid_env): with context.begin_transaction(): op.execute("""INSERT INTO idea_content_positive_link (id) SELECT id FROM idea_content_widget_link""") with context.begin_transaction(): try: op.drop_constraint( "idea_content_widget_link_idea_content_link_id_id", "idea_content_widget_link") except: pass with context.begin_transaction(): op.create_foreign_key( "idea_content_widget_link_idea_content_positive_link_id_id", "idea_content_widget_link", "idea_content_positive_link", ["id"], ["id"])
def downgrade(pyramid_env): schema, user = config.get('db_schema'), config.get('db_user') with context.begin_transaction(): for tablename in tables: index_name = "%s_%s_%s_UNQC_base_id_tombstone_date" % ( schema, user, tablename) op.drop_constraint(index_name, tablename, schema=schema) op.add_column(tablename, sa.Column('is_tombstone', sa.SmallInteger, server_default="0")) # repopulate is_tombstone with transaction.manager: for tablename in tables: op.execute('UPDATE %s set "is_tombstone" = (CASE WHEN "tombstone_date" IS NULL THEN 0 ELSE 1 END)' % (tablename,)) mark_changed() with context.begin_transaction(): for tablename in tables: op.drop_column(tablename, "base_id") op.drop_column(tablename, "tombstone_date") op.drop_table(tablename+ID_TABLE) op.execute('ALTER TABLE %s ADD CHECK ("is_tombstone" IN (0, 1))'%(tablename,))
def downgrade(): table_prefix = context.config.get_main_option('table_prefix') op.drop_constraint('_repo_name_unique', table_prefix + 'repos') op.alter_column(table_prefix + 'repos', 'user_key', existing_type=sa.UnicodeText(), type_=sa.String(255))
def downgrade(): op.drop_constraint('ckan_api_uq', 'user')
def upgrade(): # ### commands auto generated by Alembic - please adjust! ### op.add_column('bit_appsflyer_connector', sa.Column('id', sa.Integer(), nullable=False)) op.drop_constraint(u'bit_appsflyer_connector_connector_id_fkey', 'bit_appsflyer_connector', type_='foreignkey') op.create_foreign_key(None, 'bit_appsflyer_connector', 'bit_connectors', ['id'], ['id']) op.drop_column('bit_appsflyer_connector', 'connector_id') # ### end Alembic commands ###
def downgrade(): # ### commands auto generated by Alembic - please adjust! ### op.add_column('bit_appsflyer_connector', sa.Column('connector_id', sa.INTEGER(), autoincrement=False, nullable=False)) op.drop_constraint(None, 'bit_appsflyer_connector', type_='foreignkey') op.create_foreign_key(u'bit_appsflyer_connector_connector_id_fkey', 'bit_appsflyer_connector', 'bit_connectors', ['connector_id'], ['id']) op.drop_column('bit_appsflyer_connector', 'id') # ### end Alembic commands ###
def downgrade(): # ### commands auto generated by Alembic - please adjust! ### op.add_column('bit_connectors_appsflyer', sa.Column('id', sa.INTEGER(), nullable=False)) op.drop_constraint(None, 'bit_connectors_appsflyer', type_='foreignkey') op.drop_column('bit_connectors_appsflyer', 'connector_id') # ### end Alembic commands ###
def downgrade(): # ### commands auto generated by Alembic - please adjust! ### op.add_column('bit_facebook_connector', sa.Column('connector_id', sa.INTEGER(), autoincrement=False, nullable=False)) op.drop_constraint(None, 'bit_facebook_connector', type_='foreignkey') op.create_foreign_key(u'bit_facebook_connector_connector_id_fkey', 'bit_facebook_connector', 'bit_connectors', ['connector_id'], ['id']) op.drop_column('bit_facebook_connector', 'id') op.drop_constraint(None, 'bit_facebook_ad_account', type_='foreignkey') op.create_foreign_key(u'bit_facebook_ad_account_connector_id_fkey', 'bit_facebook_ad_account', 'bit_facebook_connector', ['connector_id'], ['connector_id']) op.drop_constraint(None, 'bit_adwords_google_drive_storage', type_='foreignkey') op.create_foreign_key(u'bit_adwords_google_drive_storage_connector_id_fkey', 'bit_adwords_google_drive_storage', 'bit_adwords_connector', ['connector_id'], ['connector_id']) op.add_column('bit_adwords_connector', sa.Column('connector_id', sa.INTEGER(), autoincrement=False, nullable=False)) op.drop_constraint(None, 'bit_adwords_connector', type_='foreignkey') op.create_foreign_key(u'bit_adwords_connector_connector_id_fkey', 'bit_adwords_connector', 'bit_connectors', ['connector_id'], ['id']) op.drop_column('bit_adwords_connector', 'id') # ### end Alembic commands ###
def upgrade(): # ### commands auto generated by Alembic - please adjust! ### op.drop_constraint(u'bit_facebook_ad_campaigns_account_id_fkey', 'bit_facebook_ad_campaigns', type_='foreignkey') op.drop_column('bit_facebook_ad_campaigns', 'account_id') # ### end Alembic commands ###
def downgrade(): # ### commands auto generated by Alembic - please adjust! ### op.drop_constraint(None, 'bit_adwords_google_drive_storage', type_='foreignkey') op.drop_column('bit_adwords_google_drive_storage', 'connector_id') # ### end Alembic commands ###
def downgrade(): # ### commands auto generated by Alembic - please adjust! ### op.drop_constraint(None, 'bit_facebook_ad_sets', type_='foreignkey') op.create_index('ix_bit_facebook_ad_sets_campaign_id', 'bit_facebook_ad_sets', ['campaign_id'], unique=True) op.create_index('ix_bit_facebook_ad_sets_account_id', 'bit_facebook_ad_sets', ['account_id'], unique=True) op.drop_column(u'bit_facebook_ad_sets', 'ad_campaign_id') op.drop_constraint(None, 'bit_facebook_ad_campaigns', type_='foreignkey') op.create_index('ix_bit_facebook_ad_campaigns_account_id', 'bit_facebook_ad_campaigns', ['account_id'], unique=True) op.drop_column(u'bit_facebook_ad_campaigns', 'ad_account_id') op.drop_index(op.f('ix_bit_facebook_ad_native_id'), table_name='bit_facebook_ad') op.drop_table('bit_facebook_ad') # ### end Alembic commands ###
def downgrade(): # ### commands auto generated by Alembic - please adjust! ### op.drop_constraint(None, 'bit_chiter_connector', type_='foreignkey') # ### end Alembic commands ###
def downgrade(): # ### commands auto generated by Alembic - please adjust! ### op.drop_constraint(None, 'event', type_='unique') op.alter_column('event', 'description', existing_type=sa.VARCHAR(), nullable=True) # ### end Alembic commands ###
def upgrade(): # ### commands auto generated by Alembic - please adjust! ### op.create_table('location', sa.Column('id', sa.Integer(), nullable=False), sa.Column('location', sa.String(), nullable=False), sa.PrimaryKeyConstraint('id'), sa.UniqueConstraint('location') ) op.add_column('event', sa.Column('location_id', sa.Integer(), nullable=True)) op.drop_constraint('event_title_key', 'event', type_='unique') op.create_foreign_key(None, 'event', 'location', ['location_id'], ['id']) op.drop_column('event', 'title') # ### end Alembic commands ###
def downgrade(): # ### commands auto generated by Alembic - please adjust! ### op.add_column('event', sa.Column('title', sa.VARCHAR(), autoincrement=False, nullable=False)) op.drop_constraint(None, 'event', type_='foreignkey') op.create_unique_constraint('event_title_key', 'event', ['title']) op.drop_column('event', 'location_id') op.drop_table('location') # ### end Alembic commands ###
def upgrade(): ### commands auto generated by Alembic - please adjust! ### op.drop_constraint('podcast_feed_key', 'podcast', type_='unique') op.drop_constraint('podcast_name_key', 'podcast', type_='unique') op.add_column('tag', sa.Column('name', sa.String(), nullable=False)) op.create_index(op.f('ix_tag_name'), 'tag', ['name'], unique=True) ### end Alembic commands ###
def upgrade(): ### commands auto generated by Alembic - please adjust! ### op.alter_column('episode', 'title', existing_type=sa.VARCHAR(), nullable=False) op.create_index(op.f('ix_episode_link'), 'episode', ['link'], unique=True) op.drop_constraint('episode_link_key', 'episode', type_='unique') ### end Alembic commands ###
def downgrade(): ### commands auto generated by Alembic - please adjust! ### op.add_column('podcast', sa.Column('language', sa.VARCHAR(length=5), autoincrement=False, nullable=True)) op.drop_constraint(None, 'podcast', type_='foreignkey') op.drop_column('podcast', 'language_id') op.drop_index(op.f('ix_podcast_language_id'), table_name='podcast_language') op.drop_table('podcast_language') ### end Alembic commands ###
def upgrade(): ### commands auto generated by Alembic - please adjust! ### op.drop_constraint('topic_suggestion_podcast_id_fkey', 'topic_suggestion', type_='foreignkey') op.drop_column('topic_suggestion', 'podcast_id') ### end Alembic commands ###
def upgrade(): ### commands auto generated by Alembic - please adjust! ### op.drop_constraint('episode_title_key', 'episode', type_='unique') ### end Alembic commands ###
def downgrade(): ### commands auto generated by Alembic - please adjust! ### # op.drop_constraint(None, 'tv_serie', type_='unique') op.drop_column('tv_serie', 'year') ### end Alembic commands ###
def downgrade(): ### commands auto generated by Alembic - please adjust! ### op.drop_constraint('kubes_is_default_key', 'kubes', type_='unique') op.drop_column('kubes', 'is_default') ### end Alembic commands ###
def downgrade(): op.add_column('system_settings', sa.Column('created', sa.DateTime, nullable=False)) op.add_column('system_settings', sa.Column('deleted', sa.DateTime, nullable=True)) op.drop_column('system_settings', 'label') op.drop_column('system_settings', 'description') op.drop_column('system_settings', 'placeholder') op.drop_constraint('uq_system_settings_name', 'system_settings')
def downgrade(): op.drop_constraint('packages_is_default_key', 'packages', type_='unique') op.drop_column('packages', 'is_default')
def downgrade(): conn = op.get_bind() op.add_column('predefined_apps', sa.Column( 'user_id', sa.Integer, sa.ForeignKey('users.id'), nullable=False, server_default='1')) op.drop_column('pods', 'template_plan_name') op.drop_constraint('resource_role_name_unique', 'rbac_permission') op.drop_column('system_settings', 'setting_group')
def downgrade(): ### commands auto generated by Alembic - please adjust! ### op.drop_constraint(u'ippool_node_id_fkey', 'ippool', type_='foreignkey') op.drop_column('ippool', 'node_id') ### end Alembic commands ###
def upgrade(): # ### commands auto generated by Alembic - please adjust! ### op.drop_constraint('Comment_File_id_fkey', 'Comment', type_='foreignkey') op.drop_constraint('Comment_User_id_fkey', 'Comment', type_='foreignkey') op.create_foreign_key('Comment_User_id_fkey', 'Comment', 'User', ['User_id'], ['id'], ondelete='CASCADE') op.create_foreign_key('Comment_File_id_fkey', 'Comment', 'File', ['File_id'], ['id'], ondelete='CASCADE') op.drop_index('ix_LinterComment_File_id', table_name='LinterComment') op.drop_constraint('LinterComment_File_id_fkey', 'LinterComment', type_='foreignkey') op.create_index(op.f('ix_LinterComment_File_id'), 'LinterComment', ['File_id'], unique=False) op.create_foreign_key('LinterComment_File_id_fkey', 'LinterComment', 'File', ['File_id'], ['id'], ondelete='CASCADE') op.drop_constraint('LinterInstance_Work_id_fkey', 'LinterInstance', type_='foreignkey') op.create_foreign_key('LinterInstance_Work_id_fkey', 'LinterInstance', 'Work', ['Work_id'], ['id'], ondelete='CASCADE') # ### end Alembic commands ###
def downgrade(): # ### commands auto generated by Alembic - please adjust! ### op.drop_index(op.f('ix_LinterComment_File_id'), table_name='LinterComment') op.drop_constraint('LinterComment_File_id_fkey', 'LinterComment', type_='foreignkey') op.create_foreign_key('LinterComment_File_id_fkey', 'LinterComment', 'File', ['File_id'], ['id']) op.create_index('ix_LinterComment_File_id', 'LinterComment', ['File_id'], unique=False) op.drop_constraint('Comment_File_id_fkey', 'Comment', type_='foreignkey') op.drop_constraint('Comment_User_id_fkey', 'Comment', type_='foreignkey') op.create_foreign_key('Comment_User_id_fkey', 'Comment', 'User', ['User_id'], ['id']) op.create_foreign_key('Comment_File_id_fkey', 'Comment', 'File', ['File_id'], ['id']) op.drop_constraint('LinterInstance_Work_id_fkey', 'LinterInstance', type_='foreignkey') op.create_foreign_key('LinterInstance_Work_id_fkey', 'LinterInstance', 'Work', ['Work_id'], ['id']) # ### end Alembic commands ###
def upgrade(): # ### commands auto generated by Alembic - please adjust! ### op.add_column('User', sa.Column('username', sa.Unicode(), nullable=False)) op.alter_column('User', 'email', existing_type=sa.VARCHAR(), nullable=False) op.create_index(op.f('ix_User_username'), 'User', ['username'], unique=True) op.drop_constraint('User_email_key', 'User', type_='unique') # ### end Alembic commands ###
def upgrade(): # ### commands auto generated by Alembic - please adjust! ### op.drop_constraint('File_Work_id_fkey', 'File', type_='foreignkey') op.create_foreign_key('File_Work_id_fkey', 'File', 'Work', ['Work_id'], ['id'], ondelete='CASCADE') # ### end Alembic commands ###
def downgrade(): # ### commands auto generated by Alembic - please adjust! ### op.drop_constraint('File_Work_id_fkey', 'File', type_='foreignkey') op.create_foreign_key('File_Work_id_fkey', 'File', 'Work', ['Work_id'], ['id']) # ### end Alembic commands ###
def downgrade(): # ### commands auto generated by Alembic - please adjust! ### op.drop_constraint('GradeHistory_Work_id_fkey', 'GradeHistory', type_='foreignkey') op.create_foreign_key('GradeHistory_Work_id_fkey', 'GradeHistory', 'Work', ['Work_id'], ['id']) # ### end Alembic commands ###
def upgrade(): # ### commands auto generated by Alembic - please adjust! ### op.drop_constraint('event_token_key', 'event', type_='unique') op.drop_column('event', 'token') # ### end Alembic commands ###