简体   繁体   English

Liquibase:跟踪变更日志

[英]Liquibase: tracking changelogs

The project该项目

We are ~50 developers plus DevOps staff and run ~30 Oracle 12c EE instances.我们有约 50 名开发人员和 DevOps 员工,运行约 30 个 Oracle 12c EE 实例。 We have introduced Liquibase in 2018.我们在 2018 年推出了 Liquibase。

We use the Liquibase Maven plugin version 3.8.8, changelogs are stored in numerous Maven projects, these are commited to subversion in the usual trunk/tag/branch structure.我们使用 Liquibase Maven 插件版本 3.8.8,更改日志存储在许多 Maven 项目中,这些项目致力于颠覆通常的主干/标签/分支结构。

The Goal目标

We want to ease provisioning of new database instances with release versions matching the respective environments.我们希望通过与各自环境匹配的发布版本来简化新数据库实例的配置。 A typical use case is setting up a fresh database in the integration test environment.一个典型的用例是在集成测试环境中建立一个新的数据库。

One would start with an empty database schema and apply changelogs up to a certain version.可以从一个空的数据库模式开始,并将变更日志应用到某个版本。 Unfortunately, changelogs that were applied to a schema are often stored in different Maven projects.不幸的是,应用于模式的变更日志通常存储在不同的 Maven 项目中。 This makes them hard to locate.这使他们很难找到。

Liquibase does NOT store actual changeset contents (concrete DDL) in the DATABASECHANGELOG table. Liquibase 不会在DATABASECHANGELOG表中存储实际的变更集内容(具体的 DDL)。 This would solve the problem.这将解决问题。

In search of a solution, I first used maven to store the changelog's SVN revision into the DATABASECHANGELOG when liquibase:update was executed.为了寻找解决方案,我首先在执行 liquibase:update 时使用 maven 将更改日志的 SVN 修订版存储到DATABASECHANGELOG中。 Retrieving changelogs based on revision number was error prone.根据修订号检索变更日志很容易出错。

I have spend a week now to find a robust solution, googled for hours and built several test cases (with adapted parent and and concrete poms, partly using the maven scm plugin and such) but without luck.我现在花了一周的时间来寻找一个强大的解决方案,用谷歌搜索了几个小时并构建了几个测试用例(使用适应的父级和具体的 pom,部分使用 maven scm 插件等)但没有运气。 Initially, I planned to use liquibase:tag to store file path + revision, but this works only if all changesets are in one single changelog file, which is not the case.最初,我计划使用 liquibase:tag 来存储文件路径 + 修订版,但这仅在所有变更集都在一个单独的变更日志文件中时才有效,事实并非如此。

Of course, it's desirable to have all changelogs stored in ONE location, but this is not always possible.当然,最好将所有变更日志存储在一个位置,但这并不总是可行的。 For example, scripts that require DBA privileges must to be committed to extra maven projects.例如,需要 DBA 权限的脚本必须提交给额外的 maven 项目。 I need a strong reference between each changeset and the corresponding changelog file, or the changelog must be stored directly in the DATABASECHANGELOG .我需要在每个变更集和相应的变更日志文件之间进行强引用,或者变更日志必须直接存储在DATABASECHANGELOG中。

With our current setup, "Database versioning" with Liquibase is not possible.使用我们当前的设置,使用 Liquibase 的“数据库版本控制”是不可能的。 There is theoretical tracebility, but it is up to the users to somehow locate original changelogs in a huge mess of 100+ separate Maven projects.理论上存在可追溯性,但用户可以在 100 多个独立的 Maven 项目的巨大混乱中找到原始变更日志。

Question 1: Is it possible to store the actual changelog content for each changeset into the DATABASECHANGELOG ?问题 1:是否可以将每个变更集的实际变更日志内容存储到DATABASECHANGELOG中?

Question 2: If not, how can one preserve a reference beetween a DATABASECHANGELOG entry and the originating changelog file?问题 2:如果不是,如何在DATABASECHANGELOG条目和原始更改日志文件之间保留参考?

(Also, what happens, when a changelog file is deleted from subversion by accident? The DATABASECHANGELOG would just tell me the date and time of the change, some details and a file name - pretty useless, because the actual file would be gone and there would be no way to restore the actual DDL. To prevent such a scenario, I would backup all changelog files. To do that, DATABASECHANGELOG meta data is insufficient, as Liquibase does not track SVN revisions and file paths.) (另外,当一个更改日志文件被意外从颠覆中删除时会发生什么? DATABASECHANGELOG只会告诉我更改的日期和时间,一些细节和文件名 - 非常没用,因为实际文件会消失在那里将无法恢复实际的 DDL。为了防止这种情况,我会备份所有更改日志文件。为此, DATABASECHANGELOG元数据不足,因为 Liquibase 不跟踪 SVN 修订和文件路径。)

One option would be to combine various SVN repositories into new one using SVN Externals and then create new changelog file.一种选择是使用 SVN Externals 将各种 SVN 存储库组合成新的存储库,然后创建新的变更日志文件。
You can map URLs (SVN Tag/Branch/Revisions) to a folder without copying using SVN Externals.您可以将 map URL(SVN 标记/分支/修订)复制到文件夹,而无需使用 SVN Externals 进行复制。 http://svnbook.red-bean.com/en/1.7/svn.advanced.externals.html . http://svnbook.red-bean.com/en/1.7/svn.advanced.externals.html

Hope it helps.希望能帮助到你。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM