Liquibase include with context

扶醉桌前 提交于 2019-12-07 16:21:01

问题


I need to include files in a databaseChangeLog, but these files may not exist, depending on the installation. My idea was to use something like includes with context, so Liquibase will only try to open the file when the appropriate context is given:

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

But context is not used in an include tag, and Liquibase fails because the file is not present. I’ll rather not use includeAll because I need the files to be included at specific parts of my main file. Any ideas? Thanks!


回答1:


Which version of liquibase are you using?

The "context" was added to the include tag in this commit.

Also check out this jira ticket: CORE-155.

So maybe your version of liquibase is just too old (below 3.5.0)?




回答2:


Along with what Jens said, make sure you update your XML schema version. The one they have in the documentation (currently 3.1) doesn't not support this. Updating it to 3.5 works for me.

<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">

(Note the 3.5 at the very end)



来源:https://stackoverflow.com/questions/51179726/liquibase-include-with-context

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!