创建 jpa 表后的飞行路线迁移
Flyway migration after jpa tables have been created
我将 flyway 数据库迁移工具与 spring 引导 jpa 项目一起使用。当我 运行 服务器 first flyway 想要迁移 sqls 时,但尚未创建表。在这种情况下,flyway returns 是一个类似
的错误
Caused by: org.flywaydb.core.internal.command.DbMigrate$FlywayMigrateSqlException:
Migration V1__countries_and_states.sql failed
SQL State : 42S02
Error Code : 1146
Message : Table 'wallet.country' doesn't exist
Location : db/migration/V1__countries_and_states.sql (/root/IdeaProjects/service/target/classes/db/migration/V1__countries_and_states.sql)
Line : 1
我使用这些选项配置了 application.properties 文件:
- spring.flyway.baseline-on-migrate=true
- spring.flyway.enabled=真
- spring.flyway.clean-on-validation-error=true
- spring.flyway.init-on-migrate=true
我希望我的迁移已经成功完成。
您的第一次迁移必须创建表!
可以使用如下配置属性:flyway.out-of-order = true
。它说飞行路线在 hibernate/jpa 成为 created/updated 表之后工作。
我将 flyway 数据库迁移工具与 spring 引导 jpa 项目一起使用。当我 运行 服务器 first flyway 想要迁移 sqls 时,但尚未创建表。在这种情况下,flyway returns 是一个类似
的错误Caused by: org.flywaydb.core.internal.command.DbMigrate$FlywayMigrateSqlException:
Migration V1__countries_and_states.sql failed
SQL State : 42S02
Error Code : 1146
Message : Table 'wallet.country' doesn't exist
Location : db/migration/V1__countries_and_states.sql (/root/IdeaProjects/service/target/classes/db/migration/V1__countries_and_states.sql)
Line : 1
我使用这些选项配置了 application.properties 文件:
- spring.flyway.baseline-on-migrate=true
- spring.flyway.enabled=真
- spring.flyway.clean-on-validation-error=true
- spring.flyway.init-on-migrate=true
我希望我的迁移已经成功完成。
您的第一次迁移必须创建表!
可以使用如下配置属性:flyway.out-of-order = true
。它说飞行路线在 hibernate/jpa 成为 created/updated 表之后工作。