我们从Python开源项目中,提取了以下50个代码示例,用于说明如何使用alembic.op.drop_column()。
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(): ### 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(): table_prefix = context.config.get_main_option('table_prefix') op.drop_column(table_prefix + 'repos', 'manage_master')
def downgrade(): table_prefix = context.config.get_main_option('table_prefix') op.drop_column(table_prefix + 'changes_whitelist', 'fuel_task')
def downgrade(): # ### commands auto generated by Alembic - please adjust! ### op.drop_column('answers', 'create_time') # ### end Alembic commands ###
def downgrade(): # ### commands auto generated by Alembic - please adjust! ### op.drop_column('questions', 'create_time') # ### end Alembic commands ###
def downgrade(): # ### commands auto generated by Alembic - please adjust! ### op.drop_column('named_tag', 'file_regexp') # ### end Alembic commands ###
def upgrade(): # ### commands auto generated by Alembic - please adjust! ### op.drop_column('custom_tag', 'id') op.drop_column('likes', 'id') op.drop_column('user_tag', 'id') # ### end Alembic commands ###
def downgrade(): ### commands auto generated by Alembic - please adjust! ### op.drop_column('subscription', 'end_point') ### end Alembic commands ###
def downgrade(): ### commands auto generated by Alembic - please adjust! ### op.drop_column('result', 'profile_description') ### end Alembic commands ###
def downgrade(): op.drop_column('user', 'privacy_mode')
def downgrade(): op.drop_column('app', 'long_description')
def downgrade(): op.drop_column('blogpost', 'published') op.drop_column('blogpost', 'updated')
def downgrade(): op.drop_column('user', 'admin')
def downgrade(): op.create_table( 'featured', sa.Column('id', sa.Integer, primary_key=True), sa.Column('created', sa.Text, default=make_timestamp), sa.Column('app_id', sa.Integer, sa.ForeignKey('app.id'), unique=True) ) query = 'INSERT INTO "featured" (app_id) SELECT id FROM "app" WHERE featured=true;' op.execute(query) op.drop_column('app', 'featured')
def upgrade(): op.drop_column('project', 'completed')
def upgrade(): op.drop_column('project', 'time_estimate') op.drop_column('project', 'time_limit') op.drop_column('project', 'calibration_frac') op.drop_column('project', 'bolt_course_id') op.drop_column('project', 'long_tasks')
def upgrade(): op.drop_column('project', 'hidden')
def downgrade(): op.drop_column('user', field)
def downgrade(): op.drop_column('task_run', field) op.drop_column('project', 'secret_key')
def downgrade(): op.drop_column('app', 'webhook')
def downgrade(): op.drop_column('user', 'pro')
def downgrade(): op.drop_column('user', 'twitter_user_id')
def downgrade(): op.drop_column('app', field)
def downgrade(): op.drop_column('task', field)
def downgrade(): op.drop_column('project', 'published')
def downgrade(): op.drop_column('task', 'n_answers')
def downgrade(): op.drop_column('user', 'google_user_id')
def downgrade(): op.drop_column('user', 'subscribed')
def downgrade(): op.drop_column('blogpost', field) op.drop_column('blogpost', 'info')
def downgrade(): op.drop_column('user', 'valid_email') op.drop_column('user', 'confirmation_email_sent')
def downgrade(): table_prefix = context.config.get_main_option('table_prefix') op.drop_column(table_prefix + 'resource_values', 'overrides')
def downgrade(): # ### commands auto generated by Alembic - please adjust! ### op.drop_column('bit_etl_tables', 'is_active') # ### end Alembic commands ###
def downgrade(): # ### commands auto generated by Alembic - please adjust! ### op.drop_column('bit_performance_report', 'mobile_app_purchases') op.drop_column('bit_performance_report', 'mobile_app_installs') op.drop_column('bit_performance_report', 'cost_per_mobile_app_purchases') op.drop_column('bit_performance_report', 'cost_per_mobile_app_installs') op.drop_column('bit_facebook_daily_ad_insights_impression_device', 'mobile_app_purchases') op.drop_column('bit_facebook_daily_ad_insights_impression_device', 'mobile_app_installs') op.drop_column('bit_facebook_daily_ad_insights_impression_device', 'cost_per_mobile_app_purchases') op.drop_column('bit_facebook_daily_ad_insights_impression_device', 'cost_per_mobile_app_installs') # ### end Alembic commands ###
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.drop_column('bit_etl_tables', 'save_in_prt') # ### end Alembic commands ###
def downgrade(): # ### commands auto generated by Alembic - please adjust! ### op.drop_column('table_columns', 'is_index') # ### end Alembic commands ###
def downgrade(): # ### commands auto generated by Alembic - please adjust! ### op.drop_column('bit_etl_tables', 'datasource') # ### end Alembic commands ###
def downgrade(): # ### commands auto generated by Alembic - please adjust! ### op.drop_column('bit_facebook_daily_ad_insights_impression_device', 'cost') # ### end Alembic commands ###
def upgrade(): # ### commands auto generated by Alembic - please adjust! ### op.add_column('bit_connectors_appsflyer', sa.Column('connector_id', sa.Integer(), nullable=False)) op.create_foreign_key(None, 'bit_connectors_appsflyer', 'bit_connectors', ['connector_id'], ['id']) op.drop_column('bit_connectors_appsflyer', '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_daily_ad_insights', sa.Column('campaign_id', sa.VARCHAR(length=255), autoincrement=False, nullable=True)) op.add_column('bit_facebook_daily_ad_insights', sa.Column('native_id', sa.VARCHAR(length=255), autoincrement=False, nullable=True)) op.create_index('ix_bit_facebook_daily_ad_insights_native_id', 'bit_facebook_daily_ad_insights', ['native_id'], unique=True) op.drop_column('bit_facebook_daily_ad_insights', 'date_start') # ### end Alembic commands ###
def downgrade(): # ### commands auto generated by Alembic - please adjust! ### op.drop_column('bit_etl_tables', 'sync_next_time') op.drop_column('bit_etl_tables', 'sync_last_time') # ### 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 downgrade(): # ### commands auto generated by Alembic - please adjust! ### op.drop_column('bit_etl_tables', 'calculate_progress') # ### end Alembic commands ###
def downgrade(): # ### commands auto generated by Alembic - please adjust! ### op.drop_column('bit_etl_tables', 'sync_periodic') # ### end Alembic commands ###
def downgrade(): # ### commands auto generated by Alembic - please adjust! ### op.drop_column('bit_etl_tables', 'downloaded_rows') # ### end Alembic commands ###