After you change something in your database models you should update the database itself. It can be done easily with the following command:
Note 1.. If you added some code including changes done into your model, and then run flask dbupdate and see some weird errors like Error: no such command "dbupdate" it means you have a compilation error. Try to run your code and see if there any errors, fix them and try to update the database again. To make sure there are not compilation errors, run the following command:
Note 2. Another reason for this error can be that you didn't add the following environment variable:
Warning If you work on the same codebase from different computers and update the same database you will experience Alembic migration conflicts. The error usually says
alembic.util.exc.CommandError: Target database is not up to date
alembic.util.exc.CommandError: Can't locate revision identified by 'somenumber'
If you experience such errors:
If you are trying to update database and see something like "dbupdate no such command", check your virtual environment. Check venv/Lib/site-packages folder to see if installation still exists (sometimes if you move the root folder the files may be presented on the disc but the current virtual environment just doesn't see them, so reinstall all packages from scratch.)