2

I have a flask application running with Sql Alchemy. Recently I have modified a table. And did it again. Initially it was working fine. But when I tried to migrate the db with command :

flask db migrate

I am getting error as :

ERROR [root] Error: Target database is not up to date.

With analysis I came to know that last migration was not successful and I have to run the following command to solve it.

flask db stamp head
flask db migrate
flask db upgrade

I did the same but now I am getting error in 'flask db upgrade' as below :

ERROR [root] Error: No support for ALTER of constraints in SQLite dialect

How can this be solved...?

The application is development and I can drop the tables if needed and initialize the db again. If I drop the tables, do I need to drop 'alembic_version' table as well...??

  • See this link : [https://stackoverflow.com/questions/53047429/how-to-use-flask-migrate-to-do-database-migration/53049045#53049045](https://stackoverflow.com/questions/53047429/how-to-use-flask-migrate-to-do-database-migration/53049045#53049045). – Tobin Sep 18 '19 at 11:07

1 Answers1

0

All I had to do was to remove all the tables including 'alembic_version'. And then recreate all the tables.

Tried it using :

db.drop_all()
db.create_all()

But was getting same error because 'alembic_version' was not deleted. Then I deleted all the tables manually including 'alembic_version'. And recreated all using below commands :

alembic stamp head
flask db stamp head
flask db current
flask db migrate
flask db upgrade

All the commands were successful. And I just had to populate the data in the tables.