PreConditions not working with outputfile

Hi,

 

we have following problem.

 

When using preConditions either on ChangeLog or changeSet level everything runs as expected when update is run directly on the database.

 

When generating an upgrade script either on CLI or Ant the preconditions are not taken in account and everything is included in the upgrade scipt.

 

We have to hand the scripts over to the DBAs to put it in production, so this is a big issue for us.

 

We are using liquibase 3.0.7

In updateSql mode the changelog-level preconditions should fire, but the changeSet level ones normally cannot. The reason for that is because if the previous changes are not actually executing it is unknown whether what they are checking actually corresponds to the “real” state of the database when the given change will be ran from the script.


There is a “onSqlOutput” attribute on  the preconditions tag that will control this, however. Setting it to TEST will make the precondition run, even in updateSql mode.


Nathan

Nathan


The gold question is: why precondition isn’t wrote in outputfile?

It’s not written because the precondition execution is more of a runtime check that something that will alter the state of the database. Adding the SELECT statements didn’t seem to make sense, plus preconditions are often not just SQL but java code as well.


Nathan