本文整理汇总了Python中alembic.op.drop_column方法的典型用法代码示例。如果您正苦于以下问题:Python op.drop_column方法的具体用法?Python op.drop_column怎么用?Python op.drop_column使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类alembic.op
的用法示例。
在下文中一共展示了op.drop_column方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: upgrade
# 需要导入模块: from alembic import op [as 别名]
# 或者: from alembic.op import drop_column [as 别名]
def upgrade():
for table_name in ("resource", "resource_history", "metric"):
creator_col = sa.Column("creator", sa.String(255))
created_by_user_id_col = sa.Column("created_by_user_id",
sa.String(255))
created_by_project_id_col = sa.Column("created_by_project_id",
sa.String(255))
op.add_column(table_name, creator_col)
t = sa.sql.table(
table_name, creator_col,
created_by_user_id_col, created_by_project_id_col)
op.execute(
t.update().values(
creator=(
created_by_user_id_col + ":" + created_by_project_id_col
)).where((created_by_user_id_col is not None)
| (created_by_project_id_col is not None)))
op.drop_column(table_name, "created_by_user_id")
op.drop_column(table_name, "created_by_project_id")
示例2: downgrade
# 需要导入模块: from alembic import op [as 别名]
# 或者: from alembic.op import drop_column [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_column [as 别名]
def downgrade():
for c in tables.Tasks.__add_result_links__:
op.drop_column(tables.Tasks.__tablename__, c.name)
示例4: downgrade
# 需要导入模块: from alembic import op [as 别名]
# 或者: from alembic.op import drop_column [as 别名]
def downgrade():
### commands auto generated by Alembic - please adjust! ###
op.drop_column('use_of_force_incidents', 'received_date')
op.drop_table('chart_blocks')
op.drop_table('chart_block_defaults')
### end Alembic commands ###
示例5: downgrade
# 需要导入模块: from alembic import op [as 别名]
# 或者: from alembic.op import drop_column [as 别名]
def downgrade():
op.drop_column('officer_involved_shootings_bpd', 'case_number')
示例6: downgrade
# 需要导入模块: from alembic import op [as 别名]
# 或者: from alembic.op import drop_column [as 别名]
def downgrade():
### commands auto generated by Alembic - please adjust! ###
op.drop_column('use_of_force_incidents', 'resident_age')
op.drop_column('use_of_force_incidents', 'officer_age')
op.drop_column('citizen_complaint', 'resident_age')
op.drop_column('citizen_complaint', 'officer_age')
### end Alembic commands ###
示例7: upgrade
# 需要导入模块: from alembic import op [as 别名]
# 或者: from alembic.op import drop_column [as 别名]
def upgrade():
### commands auto generated by Alembic - please adjust! ###
op.add_column('citizen_complaints', sa.Column('allegation', sa.String(length=255), nullable=True))
op.add_column('citizen_complaints', sa.Column('allegation_type', sa.String(length=255), nullable=True))
op.drop_column('citizen_complaints', 'category')
### end Alembic commands ###
示例8: downgrade
# 需要导入模块: from alembic import op [as 别名]
# 或者: from alembic.op import drop_column [as 别名]
def downgrade():
### commands auto generated by Alembic - please adjust! ###
op.add_column('citizen_complaints', sa.Column('category', sa.VARCHAR(length=255), autoincrement=False, nullable=True))
op.drop_column('citizen_complaints', 'allegation_type')
op.drop_column('citizen_complaints', 'allegation')
### end Alembic commands ###
示例9: downgrade
# 需要导入模块: from alembic import op [as 别名]
# 或者: from alembic.op import drop_column [as 别名]
def downgrade():
### commands auto generated by Alembic - please adjust! ###
op.add_column('denominator_values', sa.Column('arrests', sa.INTEGER(), autoincrement=False, nullable=True))
op.drop_column('denominator_values', 'officers_out_on_service')
### end Alembic commands ###
示例10: downgrade
# 需要导入模块: from alembic import op [as 别名]
# 或者: from alembic.op import drop_column [as 别名]
def downgrade():
### commands auto generated by Alembic - please adjust! ###
op.drop_column('use_of_force_incidents', 'received_date')
### end Alembic commands ###
示例11: upgrade
# 需要导入模块: from alembic import op [as 别名]
# 或者: from alembic.op import drop_column [as 别名]
def upgrade():
# create the has_disposition column
op.add_column('officer_involved_shootings_bpd', sa.Column('has_disposition', sa.Boolean(), nullable=True))
# update the has_disposition column based on values in the disposition column
db_bind = op.get_bind()
db_bind.execute(sa.sql.text('''
UPDATE officer_involved_shootings_bpd SET has_disposition = (disposition != '' AND disposition IS NOT NULL)
'''))
# drop the disposition column
op.drop_column('officer_involved_shootings_bpd', 'disposition')
示例12: downgrade
# 需要导入模块: from alembic import op [as 别名]
# 或者: from alembic.op import drop_column [as 别名]
def downgrade():
op.add_column('officer_involved_shootings_bpd', sa.Column('disposition', sa.VARCHAR(length=255), autoincrement=False, nullable=True))
op.drop_column('officer_involved_shootings_bpd', 'has_disposition')
示例13: downgrade
# 需要导入模块: from alembic import op [as 别名]
# 或者: from alembic.op import drop_column [as 别名]
def downgrade():
op.drop_column('chart_blocks', 'order')
示例14: upgrade
# 需要导入模块: from alembic import op [as 别名]
# 或者: from alembic.op import drop_column [as 别名]
def upgrade():
op.add_column('use_of_force_incidents_bpd', sa.Column('case_number', sa.String(length=128), nullable=True))
op.add_column('use_of_force_incidents_bpd', sa.Column('completed_date', sa.DateTime(), nullable=True))
op.add_column('use_of_force_incidents_bpd', sa.Column('received_date', sa.DateTime(), nullable=True))
op.drop_column('use_of_force_incidents_bpd', 'division')
op.drop_column('use_of_force_incidents_bpd', 'bureau')
op.drop_column('use_of_force_incidents_bpd', 'resident_weapon_used')
示例15: downgrade
# 需要导入模块: from alembic import op [as 别名]
# 或者: from alembic.op import drop_column [as 别名]
def downgrade():
op.add_column('use_of_force_incidents_bpd', sa.Column('resident_weapon_used', sa.VARCHAR(length=255), autoincrement=False, nullable=True))
op.add_column('use_of_force_incidents_bpd', sa.Column('bureau', sa.VARCHAR(length=255), autoincrement=False, nullable=True))
op.add_column('use_of_force_incidents_bpd', sa.Column('division', sa.VARCHAR(length=255), autoincrement=False, nullable=True))
op.drop_column('use_of_force_incidents_bpd', 'received_date')
op.drop_column('use_of_force_incidents_bpd', 'completed_date')
op.drop_column('use_of_force_incidents_bpd', 'case_number')