0
votes

I have a number of changesets that I would like to run if a specific condition exists. For example run changesets 1, 2, and 3 only if sqlCheck executed with the excepted results.

I can copy the precondition into each changeset. However it feels like there should be a more efficient way of doing this. As the number of changesets grows, the files have a lot of these duplicates.

The preConditions element directly under databaseChangeLog seems to only configure dbms and runAs.

Is there a way to define a single preCondition that will be used by multiple change sets?

Any help is appreciated.

1
It would be good to share some specifics about your preconditions in order to get better answers. It may be that your ultimate goal is better met by a different workflow or some other liquibase feature. - SteveDonie

1 Answers

0
votes

Unfortunately this is not possible but sometimes you can avoid using preconditions when you declare a property tag instead. For example when you have preconditions for different databases like Oracle and SQL Server which have different data types like number in Oracle and float in SQL Server, you can instead of using a precondition for each database use a propertytag:

<property dbms="oracle" name="DECIMALTYPE" value="NUMBER" />
<property dbms="mssql" name="DECIMALTYPE" value="FLOAT" />