postgres-migrations
postgres-migrations copied to clipboard
Feature request: dry run functionality
For my CI pipeline, I would like to be able to dry run migrations so that I can show what migrations will run, then request approval from the user, then run them (not withstanding that there might be some change in between). The simplest form of this would be just a boolean config option passed to migrate called dryRun. If true, then instead of running the migrations we would just log a list of the migrations that will be run like the below. I guess ideally the migrations would be validated properly too but this isn's essential for my use case.
It could either output something like this
Migrations to be run:
003-some_migration.sql
004-some_other_migration.sql
or concatenate the file contents and output the actual sql.
I'm happy to raise a PR for this if there is an appetite for it...
@MatthewBurstein, I have an appetite for it as I have the same use cases as yours.
Yeah I think that sounds like a pretty sensible idea. Sorry I didn't reply sooner, I don't spend much time on this library anymore.
Happy to take a PR for this which includes tests and docs.