Gustavo Evovlockas
Gustavo Evovlockas

Reputation: 55

Liquibase include with context

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!

Upvotes: 5

Views: 5028

Answers (2)

canpan14
canpan14

Reputation: 1273

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)

Upvotes: 4

Jens
Jens

Reputation: 6383

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)?

Upvotes: 4

Related Questions