Hacker News new | ask | show | jobs
by aidos 2798 days ago
Alembic. It's made by zzzeek (Mike Bayer), who created SQLA and it's hackable to do custom migrations.

We use it by changing the models in code and then having Alembic automatically create a suitable migration for us. Then we change the migration as required (adding steps for data migrations etc). It's really simple:

    alembic revision --autogenerate -m 'changing something...'
That generates a python file with an upgrade and downgrade function. You can then customise fully as you require.

Then on the db server you can run:

    alembic upgrade head  # or downgrade etc