如何在Tomcat中运行Flyway操作。

huangapple go评论73阅读模式
英文:

how to run flyway operations in tomcat

问题

因为升级,我必须更新迁移文件以使它们与新版本兼容。这导致哈希不匹配,应用程序无法启动。在本地,我可以通过运行以下命令来修复:

mvn flyway:repair

然而,在服务器上,应用程序在Tomcat中运行,所以我无法执行这些Maven目标。

在Tomcat中运行的应用程序中执行Flyway修复的另一种方法吗?

英文:

I have a spring boot application. Because of an upgrade I must update the migration files to make them compatible to the new version. This leads to hash mismatch and the application does not start. Locally I can fix it by running

mvn flyway:repair

However, in the servers the applications run in a tomcat, so I cannot execute those maven targets.

Is there another way to execute the flyway repair in an application running in tomcat?

答案1

得分: 1

一个类似的问题在这里得到了解答。https://stackoverflow.com/a/38577633/16398766

简而言之,你可以在Spring中创建一个FlywayMigrationStrategy bean,在运行你的迁移之前执行flyway.repair()方法。

英文:

A similar question was answered here. https://stackoverflow.com/a/38577633/16398766

In short though, you create a FlywayMigrationStrategy bean in Spring to run the flyway.repair() method before your migrations.

huangapple
  • 本文由 发表于 2023年6月5日 15:57:02
  • 转载请务必保留本文链接:https://go.coder-hub.com/76404490.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定