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')
29353a1877ba_remove_featured_table.py 文件源码
python
阅读 28
收藏 0
点赞 0
评论 0
评论列表
文章目录