Flyway H2数据库创建问题

时间:2018-03-07 20:59:22

标签: java spring spring-boot

我无法根据项目的文件结构找出错误是什么,它没有遵循正确的文件路径[Pom.xml]

Caused by: org.flywaydb.core.api.FlywayException: Wrong migration name format: V1.2_create_shipwreck.sql(It should look like this: V1.2__Description.sql)
    at org.flywaydb.core.internal.resolver.MigrationInfoHelper.extractVersionAndDescription(MigrationInfoHelper.java:54) ~[flyway-core-5.0.0.jar:na]
    at org.flywaydb.core.internal.resolver.sql.SqlMigrationResolver.scanForMigrations(SqlMigrationResolver.java:133) ~[flyway-core-5.0.0.jar:na]
    at org.flywaydb.core.internal.resolver.sql.SqlMigrationResolver.resolveMigrations(SqlMigrationResolver.java:99) ~[flyway-core-5.0.0.jar:na]
    at org.flywaydb.core.internal.resolver.sql.SqlMigrationResolver.resolveMigrations(SqlMigrationResolver.java:49) ~[flyway-core-5.0.0.jar:na]
    at org.flywaydb.core.internal.resolver.CompositeMigrationResolver.collectMigrations(CompositeMigrationResolver.java:122) ~[flyway-core-5.0.0.jar:na]
    at org.flywaydb.core.internal.resolver.CompositeMigrationResolver.doFindAvailableMigrations(CompositeMigrationResolver.java:104) ~[flyway-core-5.0.0.jar:na]
    at org.flywaydb.core.internal.resolver.CompositeMigrationResolver.resolveMigrations(CompositeMigrationResolver.java:90) ~[flyway-core-5.0.0.jar:na]
    at org.flywaydb.core.internal.resolver.CompositeMigrationResolver.resolveMigrations(CompositeMigrationResolver.java:43) ~[flyway-core-5.0.0.jar:na]
    at org.flywaydb.core.internal.info.MigrationInfoServiceImpl.refresh(MigrationInfoServiceImpl.java:114) ~[flyway-core-5.0.0.jar:na]
    at org.flywaydb.core.internal.command.DbValidate$2.call(DbValidate.java:164) ~[flyway-core-5.0.0.jar:na]
    at org.flywaydb.core.internal.command.DbValidate$2.call(DbValidate.java:157) ~[flyway-core-5.0.0.jar:na]
    at org.flywaydb.core.internal.util.jdbc.TransactionTemplate.execute(TransactionTemplate.java:75) ~[flyway-core-5.0.0.jar:na]
    at org.flywaydb.core.internal.command.DbValidate.validate(DbValidate.java:157) ~[flyway-core-5.0.0.jar:na]
    at org.flywaydb.core.Flyway.doValidate(Flyway.java:1280) ~[flyway-core-5.0.0.jar:na]
    at org.flywaydb.core.Flyway.access$100(Flyway.java:71) ~[flyway-core-5.0.0.jar:na]
    at org.flywaydb.core.Flyway$1.execute(Flyway.java:1176) ~[flyway-core-5.0.0.jar:na]
    at org.flywaydb.core.Flyway$1.execute(Flyway.java:1168) ~[flyway-core-5.0.0.jar:na]
    at org.flywaydb.core.Flyway.execute(Flyway.java:1650) ~[flyway-core-5.0.0.jar:na]
    at org.flywaydb.core.Flyway.migrate(Flyway.java:1168) ~[flyway-core-5.0.0.jar:na]
    at org.springframework.boot.autoconfigure.flyway.FlywayMigrationInitializer.afterPropertiesSet(FlywayMigrationInitializer.java:66) ~[spring-boot-autoconfigure-1.3.1.RELEASE.jar:1.3.1.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1637) ~[spring-beans-4.2.4.RELEASE.jar:4.2.4.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1574) ~[spring-beans-4.2.4.RELEASE.jar:4.2.4.RELEASE]
    ... 18 common frames omitted

1 个答案:

答案 0 :(得分:0)

您的迁移文件缺少一个下划线。将V1.2_create_shipwreck.sql重命名为V1.2__create_shipwreck.sql,它应该有效。请参阅flywaydb.org

上的Flyway命名约定