Flask-migrate迁移注意事项

2018-04-16  本文已影响0人  月生鄢

Flask-Migrate使用upgrade/downgrade命令删除表的列时,出现DROP错误:

sqlalchemy.exc.OperationalError: (sqlite3.OperationalError) near "DROP": syntax error [SQL: 'ALTER TABLE "Records" DROP COLUMN username']

解决方案:

with op.batch_alter_table('comment') as batch_op:

    batch_op.drop_column('date')

    batch_op.drop_column('text')

详情:https://blog.csdn.net/white_idiot/article/details/78533046

上一篇 下一篇

猜你喜欢

热点阅读