| Table | Rows | Size |
|---|---|---|
tcs |
698 | 576 kB |
tc_submissions |
700 | 512 kB |
alembic_version |
1 | 24 kB |
flights |
0 | 24 kB |
After modifying a model in postgres/models.py, generate and apply the migration on your development system:
podman exec kalcloud-flask flask --app app db migrate -m "describe change" podman exec kalcloud-flask flask --app app db upgrade
db migrate generates a versioned migration script in flask/migrations/versions/.
This only needs to be run once on the development system — commit the resulting script to git.
On each operational system (e.g. kalcloud), pull the latest code and run only db upgrade
to apply the pending migration:
git pull podman exec kalcloud-flask flask --app app db upgrade
Other useful commands:
podman exec kalcloud-flask flask --app app db current # current migration version podman exec kalcloud-flask flask --app app db history # migration history podman exec kalcloud-flask flask --app app db downgrade # roll back one version