Hacker News new | past | comments | ask | show | jobs | submit login

How do people typically do migrations in production anyway - what tools are used? what are the best practices?



Flyway is generally the most popular. Django/alembic in the python world.

I think most migration tools are missing a lot of features that would make them safer and easier to use. Modern teams merge a lot and deploy frequently, but most migration tools are built for a db admin manually running commands.

I wrote a migration cli tool (and golang library) that I think is more suited to modern workflows, if you check it out I’d appreciate any feedback!

https://github.com/peterldowns/pgmigrate


I used sqitch in a past job and loved it, but I had to basically implement what pgroll does automatically in order to ensure smooth migrations, and I hit plenty of issues along the way. Learned a lot, but pgroll looks much friendlier.


Flyway and Liquibase are typical migration tools.

Best practice is to have your new code backwards-compatible with the old schema so you can do blue-green deployments.


At my job we do database migrations 1 week and then deploy code the next. That way if any problems happen in either, it’s easier to roll back.




Consider applying for YC's W25 batch! Applications are open till Nov 12.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: