【问题标题】:baseline-on-migrate with Flyway and Spring Boot使用 Flyway 和 Spring Boot 迁移基线
【发布时间】:2019-08-07 09:02:22
【问题描述】:

我之前看过这个帖子,但我已经实施了所提供的解决方案,所以我再次询问我的具体情况的更多细节。我正在尝试将 Flyway 集成到我的 SpringBoot 应用程序中(使用 H2)。我在 pom.xml 中添加了以下内容:

<dependency>
    <groupId>org.flywaydb</groupId>
    <artifactId>flyway-core</artifactId>
</dependency>

对于 application.properties 我都试过了:

flyway.baselineOnMigrate=true

和:

flyway.baseline-on-migrate=false

但我一直收到错误:

Found non-empty schema(s) "PUBLIC" without schema history table! Use baseline() or set baselineOnMigrate to true to initialize the schema history table.

我已经尝试过我看到的各种其他解决方案,包括将 Flyway 添加为插件,而不仅仅是 POM 中的依赖项,但似乎没有任何效果。有谁知道我错过了什么?谢谢!

【问题讨论】:

  • 你使用的是哪个版本的 Spring Boot?
  • 哦,你说得对!我使用的是 2.1.3(使用 Java 11)。我听说大多数兼容性问题都已解决,但我想没有。我把它降到了 1.5.19(和 Java 8),现在它工作正常。知道有什么方法可以解决这个问题吗?非常感谢你让我直截了当!

标签: spring-boot h2 flyway


【解决方案1】:

我知道这是一个有点老的问题,但在 Spring boot 2.x 中你应该使用 spring.flyway.baseline-on-migrate = true 代替

【讨论】:

    猜你喜欢
    • 2018-08-16
    • 2018-10-07
    • 1970-01-01
    • 2021-02-07
    • 2018-12-11
    • 2020-12-31
    • 2020-02-09
    • 2021-06-12
    • 2021-07-10
    相关资源
    最近更新 更多