23

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.

TechArch
  • 273
  • 1
  • 3
  • 8

1 Answers1

28

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.

Marc Bannout
  • 388
  • 4
  • 15
Axel Fontaine
  • 34,542
  • 16
  • 106
  • 137
  • The link to the documentation page is doing a redirection. – Stephane Jul 04 '18 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 – Pranjal Gore Mar 27 '23 at 12:18