1

I have gradle spring-boot project.

I was trying to set the Flyway db migration files to different location using relative path.

  flyway:
    enabled: true
    username: sa
    password: 
    url: jdbc:h2:mem:myDB;MODE=Oracle;DB_CLOSE_DELAY=-1
    baseline-on-migrate: true
    locations: filesystem:.\..\ITest\resources\db.migration

Still file cannot be found. However when I specify the absolute location. it works.

Absolute path : C:\Projects\myApi\src\ITest\resources\db.migration

As I understood default location would be myApi/main/resources in the project

Ryuzaki L
  • 37,302
  • 12
  • 68
  • 98
Shabar
  • 2,617
  • 11
  • 57
  • 98

1 Answers1

0

Flyway will look for scripts under the path db/migration folder by default.

The naming convention for all the migration scripts is V[VERSION_NUMBER__[NAME].sql, for example V1_create_emp_table.sql

You have to create migration files under db/migration and file name starting with V, here is nice article with more information.

Ryuzaki L
  • 37,302
  • 12
  • 68
  • 98
  • As mentioned in the question can set any other path with same folder e.g. 'db/migration' with absolute path. My requirement is to set relative path – Shabar Apr 02 '23 at 21:10
  • Tried this solution as well, No luck though, https://stackoverflow.com/a/22828352 – Shabar Apr 03 '23 at 00:44
  • Actually relative path works wih `locations: classpath:db/migration` as per this solution(https://stackoverflow.com/a/58652470) dot (`.`) in the path doesn't work. – Shabar Apr 10 '23 at 13:18