重新创建Flyway迁移表

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

Recreate flyway migration table

问题

有没有一种方法告诉 Flyway 在不应用迁移的情况下重新创建 Flyway 表?例如,查看迁移文件夹中的脚本,并假设它们都已被应用,只需确保 Flyway 表包含所有这些脚本。

我们的情况是,在生产环境中不允许运行 Flyway,因为存在(ISO、银行、认证)方面的原因。规定规定我们需要彻底删除表格。因此,当我们从生产环境的副本重置测试环境时,我们需要重新创建 Flyway 表。现在,我们正在从现有的测试环境中复制和粘贴,但有时它与生产环境不同步,会出现各种问题。

因此,我们希望将我们的生产副本设置为与生产环境中的版本相同,然后从中重新创建表格,以确保一切都同步。但据我了解,Flyway 中的修复选项不会重新创建未应用的脚本...

英文:

Is there a way to tell flyway to recreate the flyway-table without applying the migrations. Eg, look into the migration-folder for scripts and assume that they all have been applied and simply make sure that the flyway table contains all of them.

Our scenario is that we are not allowed to run flyway in production and for (ISO;Banking;certifications) reasons. The rules says that we need to remove the tables completely. So when we reset our test-environments from a copy of production we need to recreate the flyway-table. Now we are copy and pasting from an existing test-environment but sometime that isn't in sync with production and all kind of problems occur.

So, we would like to setup our production-copy with the same version as in production and then recreate the tables from that making sure that everything are in sync. But to my understanding the repair-option in flyway doesn't recreate the non-applied scripts...

答案1

得分: 1

看起来你所描述的被称为基线(baseline):

你告诉 Flyway 你正在处理的数据库位于一个版本号,因此在迁移过程中将忽略此版本之前的所有脚本。

链接:https://flywaydb.org/documentation/commandline/baseline

英文:

It looks like what you're describing is called a baseline:

You tell flyway that the database you're working on is at a version number so all scripts previous to this version will be ignored during migrations.

https://flywaydb.org/documentation/commandline/baseline

huangapple
  • 本文由 发表于 2020年4月8日 15:08:57
  • 转载请务必保留本文链接:https://go.coder-hub.com/61095093.html
匿名

发表评论

匿名网友

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

确定