Quantcast
Channel: Liquibase Forums
Viewing all articles
Browse latest Browse all 2993

Why Liquibase show duplicate table error when same changelog is executed from two different Jenkins jobs?

$
0
0
I have two Jenkins jobs which apply the same changelog on the database using two different changelog.xml files.
When one job is executed after the other I'm getting duplicate table errors and etc. It works fine as long as I only use a single job. 
Also when checked the changesets applied from both Jenkins jobs has the same MD5 hash.
I'd really like to know why this is happening.

  1. <!-- changelog.xml -->
    <databaseChangeLog
    <include file="1.0/changelog-1.0.xml" relativeToChangelogFile="true"/>
    <include file="2.0/changelog-2.0.xml" relativeToChangelogFile="true"/>

    </databaseChangeLog>
  2. <!-- changelog-1.0.xml -->

    <changeSet id="1" author="isuru">
    <sql>
    CREATE TABLE `liquibase_test` (`id` int(11) DEFAULT NULL,`name` varchar(50) DEFAULT NULL)
    <comment>Comment</comment>
    </sql>
    <rollback>
    DROP TABLE `liquibase_test`
    </rollback>
    </changeSet>

    <changeSet id="2" author="isuru">
    <sql>
    insert into `liquibase_test` values(1,'test-1')
    <comment>Comment</comment>
    </sql>
    <rollback>
    DELETE FROM `liquibase_test` WHERE `id`=1
    </rollback>
    </changeSet>
    </databaseChangeLog>
  3. <!-- changelog-2.0.xml -->
    <databaseChangeLog
    <changeSet id="1" author="isuru">
    <sqlFile path="queries.sql" relativeToChangelogFile="true"/>
    <rollback>
    DELETE FROM `liquibase_test` WHERE `id`=2;
    UPDATE `liquibase_test` SET `name`='test-1' WHERE `id`=1;
    </rollback>
    </changeSet>

    </databaseChangeLog>
  4. <!-- queries.sql -->
    INSERT INTO `liquibase_test` VALUES(2,'test-2');
    UPDATE `liquibase_test` SET `name`='test-1-updated' WHERE `id`=1;

Viewing all articles
Browse latest Browse all 2993

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>