Liquibase 包含上下文

Liquibase include with context

我需要在数据库更改日志中包含文件,但这些文件可能不存在,具体取决于安装。 我的想法是使用类似 includes with context 的东西,所以 Liquibase 只会在给出适当的上下文时尝试打开文件:

<include file=”myFile” context=”myContext”/>

但是包含标签中没有使用上下文,并且 Liquibase 失败,因为文件不存在。 我宁愿不使用 includeAll,因为我需要将文件包含在我的主文件的特定部分。 有任何想法吗?谢谢!

您使用的是哪个版本的 liquibase?

已将 "context" 添加到此 commit 中的 include 标记中。

另请查看此 jira 票证:CORE-155

也许您的 liquibase 版本太旧(低于 3.5.0)?

除了 Jens 所说的,确保更新您的 XML 架构版本。他们在文档中的那个(目前是 3.1)不支持这个。将它更新到 3.5 对我有用。

<databaseChangeLog
    xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.5.xsd">

(注意最后的3.5)