-
Notifications
You must be signed in to change notification settings - Fork 106
Description
Coming from the traditional style of migration tools that you're probably familiar with, I've grown accustom to tooling that provides a clear path from an empty database, to one that fully reflects the current schema.
I believe this story starts with timestamped migration names, as schemas must be realized serially. I.e. fields can't be added to users
until users
exists. This way, timestamped migrations in a migrations
directly declare the serialized path to the most current schema. Of course, some migrations can be parallelized since a create table
cannot interfere with another create table, so long as its migrations doesn't involve foreign keys, but I don't think it's useful to get mired in implementation detail right now.
As a user, what I'd like from pgroll is:
- That it govern migration creation. This could be as simple as
pgroll new <name> <dir>
to add new migration files with the correct timestamp format to<dir>
. It may be nice to open up$EDITOR
after file creation. - Given a directory full of migrations, run all migrations within. I believe what's required here is to simply run
pgroll start -c <dir>/*
, sorted. The command could perhaps bepgroll bootstrap <dir>
I don't believe either of these things present a significant amount of work, but can greatly improve adoption. I'll likely implement (1.) and (2.) in my own fork for personal use. I'd be happy to get feedback on this proposal and open a PR if it's deemed acceptable. I likely won't have time to write tests of acceptable quality, however.