Re:Ask HN: How do you do database version control, deploymen...
by aregsarkissian on Sunday March 18, 2018 @02:41PM
(#16613506)
There are various database agnostic schema migration tools that can help. There are rails, django and laravel migrations or alembic if you use python/sqlalchemy. There also pure sql based migration systems such as flyway. There is a great pluralsight course on proper way to do migrations using flyway. Most of it applies to migrations with any migration tool. You might be able to check it out with the free trial. But basically you want to do all your add columns and add tables before deploying a new version of code. Just to make sure the old version still runs. Then after deploying the new version of code. at some point you can delete the unused columns and tables. I also like to have one database object per migration file. That way the cost of each migration is smaller and if the migration fails you don't have to fix a partial migration since each migration operation is atomic.
[ Parent
| on HN ]
Re:Ask HN: How do you do database version control, deploymen...
by w4tson on Tuesday March 20, 2018 @04:48PM
(#16632475)
I really like flyway. It’s lightweight and the best thing I can say about it is that I rarely have to bother with it. It just works.
I too find it useful to keep the migrations small and succinct. For Oracle do migrations where the DDL cannot be rolledback I choose to separate these from straight data manipulation.
A downside to the project that I see is that although it’s quite mature the author is very very slow to engage with open source modifications.
I’d still make it my first choice because of its simplicity.