-
Notifications
You must be signed in to change notification settings - Fork 1
...create migrations
When the models have been changed, make sure your database is up to date by using:
garden deploy
If you want alembic to automatically create a migration for you, you need to do the following steps: Make sure that you the required packages installed locally.
- Run
kubectl port-forward -n ENV YOUR_POSTGRES_POD 5432:5432
- Set the
POSTGRES_USER
andPOSTGRES_PASSWORD
env variables to right values(usingexport
etc) cd services/python-images
export FLASK_APP=migration.py
flask db migrate
If alembic does not detect your changes correctly, you can manually create an empty migration by using:
flask db revision -m "migration message"
You can then either manipulate the autogenerated commands or insert new commands in the new migration file.
When you are done, run garden deploy
to apply the changes to your local cluster.
Alembic is used for the migration system. Alembic does not auto-detect the following changes correctly:
- Table and column renames (are detected as deleted and added with another name)
- Column type changes (are not detected at all, remember to add conversion function when adding them manually)
This list might not be complete, be sure to check the Alembic documentation for further information.
If you are having problems with merging your migrations, run flask db heads
and flask db merge HEAD1 HEAD2 HEAD3...
. You can find more details here
- Home
- Setup
- API Documentation
- Data model
- How to...
- ...add a new remote database
- ...create migrations
- ...develop locally
- ...simplified dev setup
- ...deploy on kubernetes (internal)
- ...monitor the cluster
- ...fix expired K8s certificates
- ...add new dependencies
- ...rebuild base image
- ...add a new algorithm in R
- ...add support for new language
- ...add a new node to Kubernetes cluster
- Coding Conventions
- Roadmap
- Ownership