Target database is not up to date

前端 未结 11 1184
别那么骄傲
别那么骄傲 2020-12-12 16:54

I\'d like to make a migration for a Flask app. I am using Alembic.

However, I receive the following error.

T         


        
11条回答
  •  一整个雨季
    2020-12-12 17:22

    My stuation is like this question, When I execute "./manage.py db migrate -m 'Add relationship'", the error occused like this " alembic.util.exc.CommandError: Target database is not up to date."

    So I checked the status of my migrate:

    (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
    

    and found that the heads and the current are different!

    I fixed it by doing this steps:

    (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
    

    And now the current is same to the head

    (venv) ]#./manage.py db current
    INFO  [alembic.runtime.migration] Context impl SQLiteImpl.
    INFO  [alembic.runtime.migration] Will assume non-transactional DDL.
    d996b44eca57 (head)
    

    And now I can do the migrate again.

提交回复
热议问题