Skip to content

Latest commit

 

History

History

alembic

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Alembic configuration

We've followed the alembic tutorial, there's a good explainer there of each of the files and directories.

Running migrations in production

This is automatically done when the pixl-imaging container is started, as the entry point is migrate_and_run.sh.

Creating a new migration after editing the database model

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