检测到的已解决迁移未应用于飞行路线上的数据库 [英] Detected resolved migration not applied to database on flyway

查看:59
本文介绍了检测到的已解决迁移未应用于飞行路线上的数据库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们正在使用flyway来管理数据库架构版本,我们面临一个问题.由于我们作为一个团队工作,并使用git作为我们的源代码管理,因此在某些情况下,不同的人会在自己的本地存储库中更新数据库架构.如果发生这种情况,我们将得到

We are using flyway to manage database schema version and we are facing a problem. Since we work as a team and use git as our source code management, there would be some cases that different people update database schema on their own local repo. If that happens, we will get

检测到的已解决迁移未应用于数据库:2016.03.17.16.46"

Detected resolved migration not applied to database: 2016.03.17.16.46"

另一个人添加了时间"2016.03.17.16.46",并且我已经在该时间之后应用了一些时间戳.如果发生这种情况,我们必须清理所有数据库表并再次创建它们.我们试图在 validateOnMigrate 上设置为false,并做了 flywayClean ,但没有帮助.还有另一种方法可以改变这种情况吗?

The time "2016.03.17.16.46" was added by another person and I have already applied some timestamp later than that time. If that happens, we have to clean all database tables and create them again. We have tried to set false on validateOnMigrate and did flywayClean, but nothing help. Is there another way to change that?

推荐答案

迁移选项 outOfOrder 是您的朋友在这里.将其设置为true以允许在事实之后插入这些迁移.

The migration option outOfOrder is your friend here. Set it to true to allow inserting those migrations after the fact.

在命令行上,运行:

flyway -outOfOrder=true migrate

或者,如果您使用Maven插件:

Or if you use the Maven plugin:

mvn -Dflyway.outOfOrder=true flyway:migrate

这篇关于检测到的已解决迁移未应用于飞行路线上的数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆