3 ms·
I use the same tool across whatever language I'm in. It requires a directory of `TIMESTAMP-LABEL.DIRECTION.sql` files and then sorts them to know the order. It
by emidln 9y ago
I use the same tool across whatever language I'm in. It requires a directory of `TIMESTAMP-LABEL.DIRECTION.sql` files and then sorts them to know the order. It compares that to a database table of completed migrations to know which to run. It is extremely stupid, and throws its hands up if an error occurs (so the user can step in to fix it). It doesn't wrap things in transactions for you (not all DDL is transactional in Postgres) so you have to manually add BEGIN; and COMMIT; if you want those things.
It is glorious. I write a nice DSL called SQL for my database and there are never any surprises. If I want to write brittle migrations, idempotent migrations, transactional migrations, or data migrations, those are all on me. Anything more than this leads to needless debugging the tools and has never resulted in more clear or concise code.