Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Flyway Found more than one migration with version

I've two sql files , one for oracle and one for mySql database. Path is as follows

  db/migration/mysql/V1_1_migration.sql
  db/migration/oracle/V1_1_migration.sql

while running the test , I'm getting below error

Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'flywayInitializer' defined in class path resource [org/springframework/boot/autoconfigure/flyway/FlywayAutoConfiguration$FlywayConfiguration.class]: Invocation of init method failed; nested exception is org.flywaydb.core.api.FlywayException: Found more than one migration with version 1.1
Offenders:
-> C:\code\service\db-repository\target\classes\db\migration\oracle\V1_1__migration.sql (SQL)
-> C:\code\service\db-repository\target\classes\db\migration\mysql\V1_1__migration.sql (SQL)

Any pointers to resolve this error.

like image 370
BobCoder Avatar asked Nov 01 '25 08:11

BobCoder


1 Answers

The Flyway locations property needs a {vendor} placeholder, then Spring Boot will work out the directory from the lowercase of the database driver id (h2, mysql, oracle, etc), e.g.:

spring.flyway.locations=db/migration,db/migration/{vendor}

In the above example, vendor-agnostic scripts can go in db/migration and vendor-specific ones in db/migration/oracle etc.

like image 103
codemonkey Avatar answered Nov 03 '25 22:11

codemonkey



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!