Search code examples
migrationdatabase-migrationflyway

FlywayDB ignore sub-folder in migration


I have a situation where I would like to ignore specific folders inside of where Flyway is looking for the migration files.

Example

  • /db/Migration
    • 2.0-newBase.sql
    • /oldScripts
      • 1.1-base.sql
      • 1.2-foo.sql

I want to ignore everything inside of the 'oldScripts' sub folder. Is there a flag that I can set in Flyway configs like ignoreFolder=SOME_FOLDER or scanRecursive=false?

An example for why I would do this is say, I have 1000 scripts in my migration folder. If we onboard a new member, instead of having them run the migration on 1000 files, they could just run the one script (The new base) and proceed from there. The alternative would be to never sync those files in the first place, but then people would need to remember to check source control to prior migrations instead of just looking on their local drive.


Solution

  • This is not currently supported directly. You could put both directories at the same level in the hierarchy (without nesting them) and selectively configure flyway.locations to achieve the same thing.