Live data from Hacker News

Better Database Migrations in Postgres

craigkerstiens.com

1–10 of 89 posts

Re: Better Database Migrations in Postgres

#5
post #4

strong_migrations looks like a really useful tool. Are there similar ones for languages/frameworks besides Ruby/Rails?

For JVM languages, Flyway is quite popular (flywaydb.org) Django (python) has a builtin migration tool

Original author here, thanks for sharing it. Will update the post to add it to the list of good tools.

Re: Better Database Migrations in Postgres

#7
post #4

strong_migrations looks like a really useful tool. Are there similar ones for languages/frameworks besides Ruby/Rails?

For JVM languages, Flyway is quite popular (flywaydb.org) Django (python) has a builtin migration tool

It works well as a command line tool, so not even restricted to JVM languages.

One strong point of Flyway, besides being "just SQL", is the repeatable migrations, you can update your stored procedures, views and table documentation in the same version controlled source files without making a new copy in a new migration file for each change.

Re: Better Database Migrations in Postgres

#8
post #3

What's everyone favorite library for doing Postgres migrations using node? I'm using knex.js and still doing migrations mostly by hand.

I use Sequelize. I write migrations in Javascript using Promise chains. It does take some trial and error to figure out how to add join columns or create the join table so Sequelize knows how to work with it.

Re: Better Database Migrations in Postgres

#9
post #4

Earlier quoted context omitted.

For JVM languages, Flyway is quite popular (flywaydb.org) Django (python) has a builtin migration tool

Original author here, thanks for sharing it. Will update the post to add it to the list of good tools.

Another x-plat CLI option is Piggy - https://github.com/datalust/piggy - a side-project still early days of development, but may be interesting for the lack of (e.g. JVM) dependencies. It's a self-contained binary for Win/Mac/Linux.

DbUp, upon which Piggy is based, is a popular option in the .NET space: https://dbup.github.io/.

(Neither attempt the protections that I think strong_migrations is offering - TIL!)

Post reply on HN