We've followed the alembic tutorial, there's a good explainer there of each of the files and directories.
This is automatically done when the pixl-imaging container is started, as the entry point is migrate_and_run.sh.
For convenience, the autogenerate-migration.sh has been made.
Which you can run giving a name for the migration like this:
cd alembic
./autogenerate-migration.sh "<Description of changes to models>"
- This creates a postgres container
- Runs the existing migrations
- Checks for differences between the SQLAlchemy models and creates a new migration in versions
- Takes down the postgres container
There's a couple of manual steps:
- Check the changes autogenerated and update to match your intention
- Commit the changes and review in a pull request as normal