Flyway版本(3.0-> 4.2.0)更新了校验和,但将迁移标记为“未来状态”

时间:2018-10-25 18:36:26

标签: flyway

我目前正在努力将Flyway 3.0版本升级到4.2.0,并且从3.0-> 4.2.0开始遇到了一些麻烦。到目前为止,我已经引入了4.2.0依赖项并更新了重命名的配置字段。

在查看Flyway迁移文档和问题时,似乎当用户在4.2.0版上运行flyway时,校验和会自动更新。我认为这意味着flyway migrate或任何相关命令将通过文档触发此更新:

  

Flyway 4.0现在在计算校验和时将忽略行尾,并且元数据表中的所有现有校验和将在首次运行时自动进行调整,以与此新算法兼容。

但是,在运行flyway迁移时,校验和没有更新。作为一种变通方法,我发现了有用的repair命令,该命令将从旧版本到新版本的迁移校验和值进行了修改,并运行:

flyway repair -user=user -password=password -url=jdbc:mysql://127.0.0.1:3306/db -table=db_migrations
Flyway 4.2.0 by Boxfuse

Database: jdbc:mysql://127.0.0.1:3306/db_migrations (MySQL 5.6)
Repair of failed migration in metadata table `db_migrations`.`schema_version` not necessary. No failed migration detected.
Successfully repaired metadata table `db_migrations`.`schema_version` (execution time 00:00.005s).
Manual cleanup of the remaining effects the failed migration may still be required.
Database: jdbc:mysql://127.0.0.1:3306/db_migrations (MySQL 5.6)
Repair of failed migration in metadata table `db_migrations`.`schema_version` not necessary. No failed migration detected.
Successfully repaired metadata table `db_migrations`.`schema_version` (execution time 00:00.004s).
Manual cleanup of the remaining effects the failed migration may still be required.
[1]-  Done                    flyway repair -user=user -password=password -url=jdbc:mysql://127.0.0.1:3306/db -table=db_migrations
[2]+  Done                    flyway repair -user=user -password=password -url=jdbc:mysql://127.0.0.1:3306/db -table=db_migrations

校验和已更新,但是当我运行flyway info时,它表明所有以前的迁移现在都标记为future。浏览文档的未来定义为:

  

这些是由应用程序的较新版本执行的迁移,此版本尚不可用。例如:在版本3.0之前的类路径上,我们可以进行迁移。架构历史记录表指示已应用到版本4.0(我们不知道)的迁移。

但是,当检查版本时,我得到了正确的版本:

  

flyway -v
      Boxfuse推出的Flyway 4.2.0

TLDR:运行repair命令以更新迁移校验和,现在flyway告诉我迁移具有来自未来版本的校验和。检查了命令行飞行通道和应用程序飞行通道的版本,它们都处于4.2.0。不确定如何调试/继续。任何帮助将不胜感激。

编辑:在维护者中找到了一个对进一步定义未来的问题的评论

  

将来->已执行,不再在配置的位置中找到,比最新找到的脚本新

那么cmd线飞行通道可能无法找到它在数据库中看到的迁移脚本吗?

0 个答案:

没有答案