当前位置: 首页>>代码示例>>Python>>正文


Python op.drop_column方法代码示例

本文整理汇总了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") 
开发者ID:gnocchixyz,项目名称:gnocchi,代码行数:21,代码来源:aba5a217ca9b_merge_created_in_creator.py

示例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 ### 
开发者ID:Salamek,项目名称:gitlab-tools,代码行数:21,代码来源:19e8725e0581_.py

示例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) 
开发者ID:airshipit,项目名称:drydock,代码行数:5,代码来源:4713e7ebca9_add_task_status_links.py

示例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 ### 
开发者ID:codeforamerica,项目名称:comport,代码行数:8,代码来源:4ffa73ef2b8_.py

示例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') 
开发者ID:codeforamerica,项目名称:comport,代码行数:4,代码来源:ab97630e71ce_.py

示例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 ### 
开发者ID:codeforamerica,项目名称:comport,代码行数:9,代码来源:585a75fc356_.py

示例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 ### 
开发者ID:codeforamerica,项目名称:comport,代码行数:8,代码来源:2de736b481_.py

示例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 ### 
开发者ID:codeforamerica,项目名称:comport,代码行数:8,代码来源:2de736b481_.py

示例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 ### 
开发者ID:codeforamerica,项目名称:comport,代码行数:7,代码来源:507f3182b84_.py

示例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 ### 
开发者ID:codeforamerica,项目名称:comport,代码行数:6,代码来源:1c306b9d32_.py

示例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') 
开发者ID:codeforamerica,项目名称:comport,代码行数:14,代码来源:7f4ae427dcf6_.py

示例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') 
开发者ID:codeforamerica,项目名称:comport,代码行数:5,代码来源:7f4ae427dcf6_.py

示例13: downgrade

# 需要导入模块: from alembic import op [as 别名]
# 或者: from alembic.op import drop_column [as 别名]
def downgrade():
    op.drop_column('chart_blocks', 'order') 
开发者ID:codeforamerica,项目名称:comport,代码行数:4,代码来源:0d39b8d2c5ce_.py

示例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') 
开发者ID:codeforamerica,项目名称:comport,代码行数:10,代码来源:77ad8047becf_.py

示例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') 
开发者ID:codeforamerica,项目名称:comport,代码行数:10,代码来源:77ad8047becf_.py


注:本文中的alembic.op.drop_column方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。