29353a1877ba_remove_featured_table.py 文件源码

python
阅读 28 收藏 0 点赞 0 评论 0

项目:FRG-Crowdsourcing 作者: 97amarnathk 项目源码 文件源码
def upgrade():
    # First, create column and fill all records with default value.
    # To avoid integrity error, the constraint non-nullable will be set after that
    op.add_column('app', sa.Column('featured', sa.Boolean, default=False))
    query = 'UPDATE "app" SET featured=false;'
    op.execute(query)
    op.alter_column('app', 'featured', nullable=False)
    query = 'UPDATE "app" SET featured=true WHERE app.id IN (SELECT app_id FROM FEATURED);'
    op.execute(query)
    op.drop_table('featured')
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号