Flyway 不会忽略乱序迁移脚本,outOfOrder=false

Flyway does not ignore out of order migration scripts, with outOfOrder=false

我没有使用 outOfOrder。 我希望能够添加一个不是最新的迁移脚本(例如,修复现有脚本的错误,而不更改该脚本)。

我希望新脚本 运行 作为正常排序的一部分,用于尚未迁移的数据库。 任何最新的数据库(例如手动修复的)都应忽略新脚本。

来自文档:

OutOfOrder - Allows migrations to be run "out of order". If you already have versions 1 and 3 applied, and now a version 2 is found, it will be applied too instead of being ignored.

这表明新脚本将被忽略,但我收到错误:

ERROR: Validate failed: Detected resolved migration not applied to database

如果数据库基线超前,是否只会忽略新脚本? 这是预期的行为吗?

如果是这样,我想我的解决方案是:

有一个拉取请求将及时合并到 Flyway 5.1.0:https://github.com/flyway/flyway/pull/1866

在此之前,您还可以选择通过将 validateOnMigrate 设置为 false 来禁用验证。