Migrations
For handling the migrations of the database we use Alembic.
Create a new migration
Bash Sessionpoetry run alembic revision --autogenerate -m "Migration name"
Apply a migration
Bash Sessionpoetry run alembic upgrade head
Handling migration issues
To look through the migration history, one can simply look into the history
Bash Sessionpoetry run alembic history
And then upgrade or downgrade as needed. Examples commands:
Bash Sessionpoetry run alembic upgrade head # To go the last version
poetry run alembic upgrade <migration hash> # To upgrade to a certain version
poetry run alembic downgrade <migration hash> # To downgrade to a certain version