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

Using preconditions in my changeLog

$
0
0
I want different changesets within my changeLog to run depending on where I am in the full software upgrade process. I was hoping to use a new table called release_table to save the state of the upgrade. Some steps run before the upgrade has started and some steps run afterwards. I thought using preConditions could solve my problem, but it appears they are being ignored.

<changeSet author="eo" id="rs-rt-2016.03.02-1" context="cleaninstall">
        <preConditions onFail= "WARN" >
            <sqlCheck  expectedResult="1">select count(*) from release_table where state='PRE'</sqlCheck>
        </preConditions>
        <comment>Only run if we are in PRE state . </comment>
        <addUniqueConstraint columnNames="E_ID" constraintName="UC_DEP_E_ID" deferrable="false" disabled="false" initiallyDeferred="false" tableName="DEPLOY_E"/>
    </changeSet>

I tried using the preCondition select state from release_table and having my expectedResult='PRE' but that didn't work either.
I tried onFail="HALT" but then a message was output and NONE of my changesets ran. Was good to see 
Unexpected error running Liquibase: Preconditions Failed

Appreciate if anyone sees where I am messing up.

Viewing all articles
Browse latest Browse all 2993

Trending Articles