I have a simple question (request?) which I have looked all over and really cannot find an answer to. As part of my routine workflow I will want to be able to test a migration on a staging server without committing it. That means running the migration within a transaction and doing everything that would be done normally exactly the same as on the PROD env except at the very end doing a ROLLBACK;
instead of a COMMIT;
(in Postgres terms).
I've only found more-or-less workaround recommendations to this. But I want/need a CLI option that basically allows me to switch between testing and committing without making file changes. Does this exist and I am just missing it?
One simple scenario that shows my use case (though I am very surprised that it isn't a basic feature): I make changes to schema/code on DEV (where there is not much data load), run tests and everything looks good. Then run the same migration on STAGING, run the same tests and find that the changes are NOT good because of performance issues that only appear on STAGING. So I need to go back to DEV and make more changes and repeat the process before actually committing my code to PROD. And at the end of all that, I would then validate my "undo" scripts.
If each time I had to rebuild my staging server (several TB) because the code was committed... that would be very silly. And if my only work around to not automatically committing migrations is this then that is frustrating because it requires me to make code changes to switch "testing" on and off. >>> There should be a CLI option.
Any feedback or help is greatly appreciated. I am trying to get my team moved over to Flyway!