We would like to use Flyway in a way where we allow to repeat last migration as long as last schemaVersion it is still not released, so the last db changefile not only would be reexecuted, but if possible, after clearing last changes (so it's not exactly the repeatable migration concept I infer).
Is there any solution or good idea to solve this need? We are using Spring Boot to configure Flyway process.
EDIT: So far (thanks to Axel) I found out this two alternatives:
0.Increment schema for ANY change, even within a release (avoiding that is the motivation of the question)
1.Use spring.flyway.cleanOnValidationError property set to true in any pipeline/deploy prior to the release one This means if we ever change a versioned script previous to the snapshot one, we'd realize when deploying in the release pipeline
2.Work with repeatable migrations (R__) and make some hack to change the name to a versioned migration during release pipeline Problem: CREATES and DROPS are ok, but ALTERS require PL/SQL for the IF EXISTS part
3.Change db migration provider to one that supports downgrade (the very same flyway documentation says this is usually a problematic idea)
If nobody finds a better solution, I'll acccept Axel's answer
Set flyway.cleanOnValidationError to true to get what you want (or very close anyway): rapid iteration in dev, with automatic schema recreation when a migration changes.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With