i'm having issue trying rollback changeset referring sibling-changeset.
master-changelog.xml
- includes v.1.changes.xml (here table created)
- includes v.2.changes xml (here table dropped , refer changeset v.1.changes.xml rollback)
however no matter how reference changeset in v.1.changes.xml it's not visible v.2.changes.xml , i'm getting liquibase.exception.setupexception: liquibase.parser.core.parsednodeexception: change set not found.
master-changelog.xml
<include file="v1/v1.changes.xml" relativetochangelogfile="true"/> <include file="v2/v2.changes.xml" relativetochangelogfile="true"/> v1.changes.xml
<changeset id="1" author="dima"> <createtable tablename="test-table"> <column name="test" type="number"></column> </createtable> </changeset> v2.changes.xml
<changeset id="1" author="dima"> <droptable tablename="test"/> <rollback changesetauthor="dima" changesetid="1" changesetpath="src/main/resources/std/v1/v1.changes.xml"/> </changeset>
it appears you're using maven, answer maven specific, have not been able reproduce solution on command line.
first of all, it's possible liquibase confused because you're using same changeset id in both files, , i'm not sure if correctly scopes ids changeset file, or if ids need global. might first try changing id on second changeset , see if clears you.
if that's not issue, trick getting work make sure relative references in context of java classpath. interpret example, classpath resources of files be:
std/master-changelog.xml std/v1/v1.changes.xml std/v2/v2.changes.xml when running migration, changelogfile setting should reference classpath resource, not disk file; i.e. std/master-changelog.xml instead of src/main/resources/std/master-changelog.xml. puts origin changelog in classpath context rather file context.
in v2.changes.xml, refer first change using classpath resource name: v1/v1.changes.xml. should allow liquibase find correctly.
if have more 1 level of changelog file inclusion, might running this issue prevents liquibase finding sibling changelogs below first level of inclusion. until pull request merged , released, you'll limited single level of file inclusion.
this solution assuming you're using maven plugin, liquibase still find changelog, since maven puts resource files on classpath default. attach plugin process-resources step (or later) source resources in target/classes directory when migration run.
Comments
Post a Comment