I am trying to use Liquibase to track changes in a postgresql database using dropwizard-migrations. I would like to be able to start the migration in an existing production database instead of restoring from scratch. I'm testing the scene right now. I created a prerequisite change set.
<changeSet id="3" author="me"> <preConditions onFail="CONTINUE"> <not> <sequenceExists sequenceName="emails_id_seq"/> </not> </preConditions> <createSequence sequenceName="emails_id_seq" startValue="1" incrementBy="1" /> </changeSet>
My goal is to skip applying the change set if the sequence already exists. It seems simple, but it does not work.
ERROR [2013-09-13 22:19:22,564] liquibase: Change Set migrations.xml::3::me failed. Error: Error executing SQL CREATE SEQUENCE emails_id_seq START WITH 1 INCREMENT BY 1: ERROR: relation "emails_id_seq" already exists ! liquibase.exception.DatabaseException: Error executing SQL CREATE SEQUENCE emails_id_seq START WITH 1 INCREMENT BY 1: ERROR: relation "emails_id_seq" already exists
I tried to use MARK_RAN instead of CONTINUE. No luck with that.
source share