我的陈述就像这样的问题,当我执行“ ./manage.py db migration -m'添加关系'”时,出现了这样的错误“alembic.util.exc.CommandError:目标数据库不是最新的。”
因此,我检查了迁移状态:
(venv) ]#./manage.py db heads
d996b44eca57 (head)
(venv) ]#./manage.py db current
INFO [alembic.runtime.migration] Context impl SQLiteImpl.
INFO [alembic.runtime.migration] Will assume non-transactional DDL.
715f79abbd75
并发现磁头和电流不同!
我通过执行以下步骤修复了该问题:
(venv)]#./manage.py db stamp heads
INFO [alembic.runtime.migration] Context impl SQLiteImpl.
INFO [alembic.runtime.migration] Will assume non-transactional DDL.
INFO [alembic.runtime.migration] Running stamp_revision 715f79abbd75 -> d996b44eca57
而现在的头脑是一样的
(venv) ]#./manage.py db current
INFO [alembic.runtime.migration] Context impl SQLiteImpl.
INFO [alembic.runtime.migration] Will assume non-transactional DDL.
d996b44eca57 (head)
现在,我可以再次进行迁移了。