If I want to organize my migrations in multiple directories (let's say I'm using SQL migrations, and under the "sql" directory I have a "main" directory and then a "special" directory).
So under sql/main I have "V1.1__some_change" etc.
Then I want to put other migrations under sql/special as well. But the migration version numbers have to be distinct across all the directories, e.g., I couldn't put "V1.1__some_other_change" in sql/special as it would cause a conflict.
But it's not that easy to manage a linear version number across many different directories. Is there a good approach to solve this issue?
Hope this question is clear.
Well it all depends on why special is "special" and how it is related to "main".
If they have the same lifecycle you could use a different numbering scheme (whole number in main, point releases in special) or track the assigned migration number in a shared resource (whiteboard, wiki page, ...) to make it easy to know which the next available one is.
If they have separate lifecycles, you could have separate Flyway instances tracking them (each with a different flyway.table).
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