问题描述
我们正在对此项目使用,目前正在开发,所有更改日志都在一个大型XML中-文件。不幸的是,这个文件的WAY太大 - 我们想要引入一个主文件,包括原始文件和任何新的文件。
We are using Liquibase for this project I'm working on right now, and all the changelogs are in one big XML-file. Unfortunately, this file has gotten WAY too big - and we want to introduce a "master" file, that includes the original file and any new ones.
旧结构:
/db/changesets-from-beginning-of-time.xml
新结构:
/db/changesets/changesets-from-beginning-of-time.xml
/db/changesets/changesets-v.1.2.3.xml
/db/changesets/changeset-master.xml
changesets - *
文件的内容只是changeset xml,而 changeset-master.xml
文件如下所示:
The content of the changesets-*
-files are simply changeset xml, while the changeset-master.xml
file looks like this:
<databaseChangeLog xmlns="...skipped...">
<include file="changesets-from-beginning-of-time.xml"
relativeToChangelogFile="true"/>
<include file="changesets-v1.2.3.xml"
relativeToChangelogFile="true"/>
</databaseChangeLog>
现在,我的数据库中的 DATABASECHANGELOG
Now, the DATABASECHANGELOG
table in my database references the old files, and thus the old changesets are run again.
根据,每个变更集由 [filepath / -name] ::: [id] ::: [author] code> - 对我来说不是最优的。
According to the Liquibase documentation, each changeset is uniquely identified by the combination
[filepath/-name]:::[id]:::[author]
- which is less than optimal for me.
所以我的问题是 - 如何重构文件结构而不破坏我的liquibase设置和清空我的数据库?
So my question is - how do I refactor the file structure without breaking my liquibase setup and emptying my database?
推荐答案
还有一些名为,描述为:
There is also something called "logicalFilePath" on liquibase which is described as:
如果我记得正确这个选项允许不包括标识符的完整文件路径。
Maybe that helps.If I remember it correctly this option allows to not include the complete file path to the identifier.
(这不适用于格式化的sql文件。 在Liquibase Jira。
(This does not work for formatted sql files though. See issue: CORE-915 in Liquibase Jira.
这篇关于重构Liquibase changelog文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!