【问题标题】:Flyway failed to initialize: none of the following migration scripts locations could be found: - classpath:db / migrationsFlyway 初始化失败:找不到以下迁移脚本位置:-classpath:db / migrations
【发布时间】:2021-10-07 20:33:26
【问题描述】:

我的 application.properties 中有以下配置,附加图像是类路径。

.

我错过了什么?

spring.jpa.hibernate.ddl-auto = validate
spring.jpa.properties.hibernate.format_sql=true
#spring.autoconfigure.exclude=org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration

# Flyway
spring.flyway.baselineOnMigrate=true
spring.flyway.check-location=true
spring.flyway.locations=classpath:db/migrations
spring.flyway.schemas=public
spring.flyway.enabled=true

【问题讨论】:

  • 删除 spirng.flyway.locations 属性(它是默认值,您修改了它)。

标签: spring-boot flyway rest


【解决方案1】:

Flyway docs 使用 大写 V 为版本化迁移添加前缀。尝试将您的迁移从 v1_1__init.sql 重命名为 V1_1__init.sql

【讨论】:

  • SQL 状态:S0001 错误代码:2714 消息:数据库中已经有一个名为“public”的对象。
  • 这似乎是您的迁移中的错误,而不是您的 Flyway 配置。在应用第一次迁移之前,您是否确保数据库为空?
猜你喜欢
  • 2019-09-10
  • 2020-05-27
  • 2016-06-04
  • 2019-04-28
  • 2019-01-16
  • 2018-02-28
  • 2018-05-26
  • 2017-08-13
  • 2020-07-04
相关资源
最近更新 更多