24

I have a question about flyway migration folder . Does sql's have to reside in project folder Application/foo/bar/main/resources/db/migration. Could it reside outside of the application cource folder?

We are using Maven.

1 Answer 1

29

By default Flyway will look for migrations on the classpath under db/migration, which on a Maven project means src/main/resources/db/migration.

You can however also use a location starting with the filesystem: prefix that can be anywhere on your disk.

See the ”Location and discovery“ section of the SQL-based migrations documentation page.

For command-line use, see the locations option on the migrate command reference page.

2
  • The link to the documentation page is doing a redirection.
    – Stephane
    Jul 4, 2018 at 10:09
  • 1
    This does not work anymore. You need the path from the repository-root. Which means try locations: filesystem:my-other-folder. If you are using Intellij, just copy the path from repository root and it will work straight away. Tested this on flyway 6.4.4 and spring-boot 2.2.6.RELEASE with java version 11 Mar 27, 2023 at 12:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.