Upgrading flask on a linux server, but getting version errors

Flask database throws errors when trying to upgrade and migrate

The following is a last resort solution for a problematic database, I have yet to find a cleaner solution for this problem.

Delete the existing version of alembic, and start from scratch

source ~/venvs/env.Vodacom-QuoteService/bin/activate

Clear the alembic table

sqlite3 [yourdbfile]
> delete * from alembic_version;

Remove the migrations folder

rm -r migrations/

Initialize the database

python manage.py db init

Upgrade and migrate the database

python manage.py db upgrade
python manage.py db migrate

Restart the service that is using the table.

Might need to rerun these three steps if the database is still not working

python manage.py db upgrade
python manage.py db migrate
(restart your service)