Request for Enhancement: Multiple include

With LiquiBase 1.9.1 I am having difficulty with multiple tags pointing to the same change log file.  I get the error, “1 change sets had duplicate identifiers”.  Has this been addressed in 2.0 beta?

According to the manual,

http://www.liquibase.org/manual/include

Currently there is no checking for looping changelogs or double inclusion of changelogs.

If you include a changelog twice, you shouldn’t run into problems because the second time around, LiquiBase will know that the changeSets have been run and won’t run them again …

I have multiple projects, say A, B, C and D.  Projects A and B may be deployed independently or together.  They both have project C as a dependency.  The change logs for A and B each include the change log for C.  The change log for project D includes the change logs for projects A and B.  The change log for project D gets the error “1 change sets had duplicate identifiers”.

A simple test verifies that double inclusion produces this error.  (Copied below.)

A workaround is to move the inclusion of changelog C to changelog D.  However, that means that all dependencies must propagate to the top level.

Can this be fixed?

Thanks,
  --Steve

changelog1.xml:
<databaseChangeLog
  xmlns=“http://www.liquibase.org/xml/ns/dbchangelog/1.9”
  xmlns:xsi=“http://www.w3.org/2001/XMLSchema-instance”
  xsi:schemaLocation=“http://www.liquibase.org/xml/ns/dbchangelog/1.9
        http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-1.9.xsd”>

 
 

changelog2.xml:
<databaseChangeLog
  xmlns=“http://www.liquibase.org/xml/ns/dbchangelog/1.9”
  xmlns:xsi=“http://www.w3.org/2001/XMLSchema-instance”
  xsi:schemaLocation=“http://www.liquibase.org/xml/ns/dbchangelog/1.9
        http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-1.9.xsd”>

<changeSet id="1" author="alfredeneuman">
	<createSequence sequenceName="hibernate_sequence" />	
</changeSet>	

       

The problem hasn’t been resolved in 2.0.  The trouble is how to best handle the duplicate changeSets.  Many will simply be ignored the second time, but if you have a runAlways=“true” attribute they will run twice in a single update.  But depending on the update, you may want to update them twice.

I created an issue to track it: http://liquibase.jira.com/browse/CORE-449

Nathan

One solution is to introduce a new Boolean attribute “once” (default false for backwards compatibility) on the elements and that cause the elements to be ignored after the first time they appear in an update.

  --Steve