<Preconditions> is not supported by sql file generation

If I use tags in a change log and then I execute it into updateDatabase ant task to generate sql file (not to update directly the database), I think the tags do not have any effect in the generated sql file.

We would have to consider the preconditions in the sql file to provide a good tool.
Maybe, in two ways:
a) Liquibase checks the preconditions in the moment of generating the sql file. If a precondition goes right, fails or gives a error, to act according to possibles values (halt,continue,mark_ran,warn) and to halt the generation of sql file, to skip the next changeSet or to write the statement in the sql file.

b) Liquibase writes each precondition tag into a sql procedure that represents the action of the precondition.

Add the onUpdateSQL attribute to your preCondition tag, like:

preConditions onFail=“MARK_RAN” onUpdateSQL=“RUN”

We currently don’t check changeSet preconditions on an updateSql because you don’t know if the precondition would fail or succeed if the prior changes had actually been ran.  It’s not ideal, but I’m not sure of a better way at the moment.

If the preconditions are on the changeset itself, they should run.  There is an open issue for that (http://liquibase.jira.com/browse/CORE-161) that will be fixed in 2.0.

Nathan

Thank you very much. (I do not know about this attribute)

But I still think a procedure on UpdateSQL that will do the action of the precondition when you execute the file against DB are great.

When I add that the onUpdateSQL to my precondition tag and run updateSQL it tells me that onUpdateSQL can’t be an element of the precondition.  And ideas why it works for you and breaks on me?