Home

KalCloud DB Admin

Database
7.8 MB
DB size
1
Active conns
99.9%
Cache hit ratio
Tables
TableRowsSize
fetched_files 1 80 kB
subsystems 4 40 kB
variables 111 40 kB
alembic_version 1 24 kB
flights 0 24 kB
tm_files 0 24 kB
instruments 0 16 kB
instrument_subsystems 0 8192 bytes
Schema Migrations

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