Bob*_*der 5 java spring flyway
我有两个sql文件,一个用于oracle,一个用于mySql数据库。路径如下
db/migration/mysql/V1_1_migration.sql
db/migration/oracle/V1_1_migration.sql
Run Code Online (Sandbox Code Playgroud)
运行测试时,我遇到以下错误
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)
Run Code Online (Sandbox Code Playgroud)
任何解决此错误的指针。
Flywaylocations属性需要一个{vendor}占位符,然后Spring Boot将从数据库驱动程序id的小写字母(h2、mysql、oracle等)中计算出目录,例如:
spring.flyway.locations=db/migration,db/migration/{vendor}
Run Code Online (Sandbox Code Playgroud)
在上面的示例中,可以放入db/migration与供应商无关的脚本,也可以放入特定于供应商的脚本db/migration/oracle等。
| 归档时间: |
|
| 查看次数: |
16168 次 |
| 最近记录: |