pypipostgresql95% confidence\u2191 86

alembic util command error can't find identifier

Full error message
I'm trying to use alembic to handle local migrations on my project. It worked the first time, but then I needed to delete the folder and restart.(don't ask why, I just had to) I'm following this tutorial and I run the command

python manage.py db init

And it was ok. But when I try to run

python manage.py db migrate

I'm getting this error:

alembic.util.CommandError: Can't locate revision identified by '31b8ab83c7d'

Now, it seems that alembic is looking for a revision that doesn't exists anymore. There is anyway to make alembic forget that file? Or like restart the comparison from None to -> auto-generated again?

Alembic stores the version history in your database. Hence it is using the value stored in your database to search for the revision. The version number for my personal database is stored in the table alembic_version: mysql> SELECT * FROM alembic_version; +-------------+ | version_num | +-------------+ | c8ad125e063 | +-------------+ 1 row in set (0.00 sec) Hint: Use the command SHOW TABLES if it's a SQL based database to see the tables. To solve your problem simply use the command: DROP TABLE alembic_version; Or whatever the name of database version table is. And then you need to re-init the migration folder using the command: python manage.py db init And then creating a new migration: python manage.py db migrate And then you should be good to go with working migrations in alembic.

API access

Get this solution programmatically \u2014 free, no authentication.

curl https://depscope.dev/api/error/3ce949c67886190b9f7bd08fff8a5f3457c0c9fe064b2a86cd07233eb1403be2
hash \u00b7 3ce949c67886190b9f7bd08fff8a5f3457c0c9fe064b2a86cd07233eb1403be2
alembic util command error can't find identifier — DepScope fix | DepScope