I have a few changeSets, in different changeLogs, which need to reference the following Liquibase property:
<property
name=“all_schema_names”
value=“public,my_schema,your_schema,his_schema,her_schema”/>
The easiest way is just to copy this text into every relevant changeLog, but that’s not very maintainable as the list of schemas changes over time.
I was hoping to use Liquibase’s “include” tag, but it doesn’t seem to do the trick.
What’s the best way to re-use a Liquibase property value in multiple changeLogs?
Thanks for any help,
Andy
In the systems I have used Liquibase on, I have always had a master changelog.xml that then included the other bits and pieces of changelog.xml. So, instead of adding on to one large xml file, I would create a new, small file that then gets included into the master. I have never used the property tag you’ve referenced, but I suspect it would work to have it in the master file. Then, it would be available to all of the included bits. My structure might have been something like this…
schema-directory:
master-changelog.xml (include the tag here, also has all of the tags for the files below)
version1-directory:
change1.xml
change2.xml
etc…
version2-directory:
change1.xml
You get the idea. There are a few little gotcha’s to having your xml in different directories like this. Unfortunately, I’m not in a place where I can access one to speak much on it. I’ll try to remember to look it up this evening and come back to post a follow-up.
Dave
You can also use any XML-level include functionality such as entity includes (http://www.ibm.com/developerworks/xml/library/x-tipgentity/index.html)
Depending on how you are calling liquibase, you could also move the property to be a system property passed to the java VM running liquibase like: -DNathan
Is there a good way to just spin through and process every file in a specific directory?
We are using the grails database-migration plugin.
we have a changelog.groovy that looks like so
databaseChangeLog = {
//include(file: “v9.3/master.xml”)
include(file: ‘v9r4/master.groovy’)
}
I’d like to just say something like
include(file: ‘v9r4/*.groovy’)
Is something like this possible?
includeAll does the trick. Somehow I missed the obvious