I am using Flask-migrate for DB management in my Flask Python app. But when I execute the command
python manage.py db init
It executes successfully but when I execute the below migrate command in Terminal. It is showing Error
python manage.py db migrate
Error Text is - alembic.util.exc.CommandError: Can't locate revision identified by 'c30bb1ppb978'
You are getting this error because in your database there is a table named alembic_version which contains previous migrations names created by Flask-migrate.Â
To get rid of the error Follow Steps
1. Find alembic_version table in your database by running below command
2. Remove this table from databse by executing below SQL QUERY
Now you can run your commands of initialize database and migrate commands.
You will not get error this time because it will create new alembic_version table in database which will contains new migration info.