SpringBoot Flyway-SQL补丁的更多阶段(分别运行非破坏性和破坏性SQL补丁)

发布时间:2020-07-07 16:55

是否可以在“两个阶段”中使用飞路运行迁移?

问题是我需要在不中断的情况下部署到生产服务器,并且SQL迁移是一个问题。

尽管我可以编写每个SQL补丁(并不是每个SQL补丁都会破坏大多数补丁),但我却可以写2次-一次不破坏更改(没有列删除等),一次不破坏更改。

所以我的问题是Flyway是否可能。

我想像from lxml import html import requests, os, json page = requests.get(webString) tree = html.fromstring(page.content) monsterArmor = tree.xpath('/html/body/div[1]/span[2]/text()') print(monsterArmor) migrations:migrate --type=non-breaking

我的SQL修补程序将这样命名:

migrations:migrate --type=breaking
回答1

有两个迁移都名为V1__...的迁移将不起作用,因为需要明确的排序,因此您需要重命名其中之一。如果要运行所有不中断的更改,请执行其他操作(例如,应用程序更新),然后在确认应用程序正常运行并稳定后再运行中断的更改,请使用target选项:

V1__loremipsum-nonbreaking-do-these-first.sql
V1_0_1__loremipsum-breaking.sql

/* Only migrates the non-breaking changes */
migrations:migrate --target=1

/* Migrates all - safe to call whether the above has been called or not */
migrations:migrate [--target=latest]