Cole StrilerCole Striler

By Cole Striler. 

[flask_migrate] Error: Can't locate revision identified by '...'

October 26, 2021

If you delete your /migrations folder, the version is still saved in the database. You must also delete this version in the database:

  1. Delete alembic_version table from database using psql:
$ psql postgres
\connect <Database>
DROP TABLE alembic_version;
\q
  1. If your target database is not up to date, you will also have to run:
$ flask db stamp head
$ flask db upgrade
  1. If you need to delete the alembic_version table on Heroku, run the following:
$ herok psql
delete from alembic_version;

By Cole Striler. 

If this was helpful or you have any other questions, reach out on Twitter! Happy to help.

© 2022, Cole Striler