Liquibase has a failOnError attribute, which you can set to false in changeSets, which include a call that may fail.
<changeSet failOnError="false"> <createSequence sequenceName="new_sequence"/> </changeSet>
This allows you to simply create a user, create a sequence, abandon user sequences and change the sequence of changing sequences, and if the operator gives an error because they / they exist / do not exist, they will still be marked as running, and the update will continue.
The disadvantage of this approach is that it will also mark them as running and continue if they are erroneous for some reason (poor permissions, connection failure, invalid SQL, etc.). A more accurate approach is to use preconditions like
<changeSet> <preconditions onFail="MARK_RAN"><not><sequenceExists/></not></preconditions> <createSequence name="new_sequence"/> </changeSet>
There is currently no userExists precondition, but you can create custom preconditions or return to the precondition. See http://www.liquibase.org/documentation/preconditions.html for documentation
Nathan voxland
source share