【无标题】

【无标题】,第1张

标题flask db migrate -m "first commit"报错

如果报错是

INFO  [alembic.runtime.migration] Context impl MySQLImpl.
INFO  [alembic.runtime.migration] Will assume non-transactional DDL.
INFO  [alembic.env] No changes in schema detected.

可以试试在navicate里把已经有的表删掉
然后再重新执行flask db migrate -m “first commit”
然后就对了

INFO  [alembic.runtime.migration] Context impl MySQLImpl.
INFO  [alembic.runtime.migration] Will assume non-transactional DDL.
INFO  [alembic.autogenerate.compare] Detected added table 'user'
INFO  [alembic.autogenerate.compare] Detected added table 'article'
INFO  [alembic.autogenerate.compare] Detected added table 'user_extension'
Generating D:\projects\pycharm_project\flask-ORM\migrations\versions\247b9194c47f_first_commit.py ...  done

再来记录一下整个过程

# 添加字段
flask db migrate -m "add password to user"
flask db upgrade
# 删除字段
flask db migrate -m "remove password from user"
flask db upgrade

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/langs/922903.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-16
下一篇 2022-05-16

发表评论

登录后才能评论

评论列表(0条)

保存