'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.



Solution 1:[1]

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.

Solution 2:[2]

There are 2 same files in \target\classes\db\migration directory. Delete one of them and restart your project.

if anything goes bad, delete your target folder and build your project again.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 codemonkey
Solution 2 A. Berk