Flyway验证失败:检测到的已解决迁移未应用于数据库

问题描述

我为Java Web应用程序创建了两个迁移sql文件:V1和V2。

在应用程序的首次启动时,一切看起来都正常。这是我在日志中看到的内容

23-Aug-2020 09:31:35.923 INFO [localhost-startStop-1] org.flywaydb.core.internal.command.DbMigrate.info Current version of schema `cloudregs`: << Empty Schema >>
23-Aug-2020 09:31:36.074 INFO [localhost-startStop-1] org.flywaydb.core.internal.command.DbMigrate.info Migrating schema `cloudregs` to version 1 - initial
23-Aug-2020 09:31:36.118 WARNING [localhost-startStop-1] org.flywaydb.core.internal.sqlscript.DefaultsqlScriptExecutor.warn DB: Changing sql mode 'NO_AUTO_CREATE_USER' is deprecated. It will be removed in a future release. (sql State: HY000 - Error Code: 3090)
23-Aug-2020 09:31:37.312 WARNING [localhost-startStop-1] org.flywaydb.core.internal.sqlscript.DefaultsqlScriptExecutor.warn DB: Changing sql mode 'NO_AUTO_CREATE_USER' is deprecated. It will be removed in a future release. (sql State: HY000 - Error Code: 3090)
23-Aug-2020 09:31:37.419 INFO [localhost-startStop-1] org.flywaydb.core.internal.command.DbMigrate.info Migrating schema `cloudregs` to version 2 - user-invite
23-Aug-2020 09:31:37.459 WARNING [localhost-startStop-1] org.flywaydb.core.internal.sqlscript.DefaultsqlScriptExecutor.warn DB: Changing sql mode 'NO_AUTO_CREATE_USER' is deprecated. It will be removed in a future release. (sql State: HY000 - Error Code: 3090)
23-Aug-2020 09:31:40.742 WARNING [localhost-startStop-1] org.flywaydb.core.internal.sqlscript.DefaultsqlScriptExecutor.warn DB: Changing sql mode 'NO_AUTO_CREATE_USER' is deprecated. It will be removed in a future release. (sql State: HY000 - Error Code: 3090)
23-Aug-2020 09:31:40.812 INFO [localhost-startStop-1] org.flywaydb.core.internal.command.DbMigrate.info Successfully applied 2 migrations to schema `cloudregs` (execution time 00:04.912s)

这是对应的flyway_schema_history

+----------------+---------+-------------+------+---------------------+----------+--------------+---------------------+----------------+---------+
| installed_rank | version | description | type | script              | checksum | installed_by | installed_on        | execution_time | success |
+----------------+---------+-------------+------+---------------------+----------+--------------+---------------------+----------------+---------+
|              2 | 2       | user-invite | sql  | V2__user-invite.sql | 39331208 | root         | 2020-08-23 09:31:40 |           3343 |       1 |
+----------------+---------+-------------+------+---------------------+----------+--------------+---------------------+----------------+---------+

似乎只有第二次迁移已保存到flyway_schema_history

重新启动应用程序时,出现以下错误

Validate Failed:
Detected resolved migration not applied to database: 1

我想念什么?

编辑:该问题似乎已通过从Flyway版本6.4.2升级到6.5.5得以解决

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)