ranjith kumar
ranjith kumar

Reputation: 1

How can i include a master changelog file inside another master changelog file in liquibase

I have a requirement where am pulling changelog files containing changesets as a maven dependency from other project module. I need to include the master changelog file of other project (which has reference to all the changesets in it)in current project from where i will execute the maven liquibase update / rollback or spring boot liuqibase setup. Is there a way to make it work?

I tried to do that like shown below

<?xml version="1.0" encoding="UTF-8" standalone="no"?><databaseChangeLog
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns="http://www.liquibase.org/xml/ns/dbchangelog"xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangeloghttp://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.0.xsd"> 

   <property name="blob" value="bytea" dbms="postgresql"/>
   <property name="blob" value="blob" dbms="derby"/>
   <preConditions>
   <or>
     <dbms type="derby"/>
     <dbms type="postgresql"/>
   </or>
   </preConditions>
   <include file="db/changelog/db.changelog-master.xml"/>
   <include file="db/changelog/changesets/2019-06-001-modeler.changelog.xml"/>
</databaseChangeLog>

But i get error Error setting up or running Liquibase: liquibase.exception.SetupException: Error Reading Migration File: Found 2 files that match db/changelog/db.changelog-master.xml

I have same folder structure in all the projects.

Upvotes: 0

Views: 2308

Answers (2)

TsviZan
TsviZan

Reputation: 128

This was a reported bug a while back and is now fixed with the later versions of Liquibase. Please try to use the latest Liquibase version and see if the issue goes away.

Below is a reference for Liquibase releases. https://github.com/liquibase/liquibase/releases

Upvotes: 1

bilak
bilak

Reputation: 4966

Liquibase can't understand which of your files with same name it should use. If it's possible you should change path to your changelog. So if your changelogs are both on path db/changelog/db.changelog-master.xml try to rename the paths at least. For example use db/changelog/module1/db.changelog-master.xml or db/changelog/db.changelog-module1-master.xml.

Upvotes: 0

Related Questions