Formatted SQL With PreConditions

>

Unfortunately the current FormattedSql parser does not support preconditions.  You could extend the default class with your own parser that would support it if you need, however.


Nathan

I have made the patch and submitted a pull request for the 2_0_x branch: https://github.com/liquibase/liquibase/pull/70

I’m quite interested in this features, and from looking at the source it doesn’t seem like too much trouble to get at least a useful subset working.  I’m thinking something like this


–changeset :

–precondition sql

–rollback


The idea being:

 - onFail would have to be provided

 - the only supported precondition would be and it must to return bit/boolean

 - onError, onUpdateSql, and onXxxMessage would be unsettable (always default)


The “sql” in the --precondition indicates it’s a type precondition, that way there’s a place for future expansion of the supported preconditions in the future (for the meantime any other value’d just raise an exception).  Would perhaps --sql-precondition be preferable?  


The “must return boolean” is at slight odds with the XML precondition (which returns a value to compare), but seems reasonable enough.


Thoughts?  I’m going to make a change along these lines for our internal use, and figured may as well try and make it generic enough for general use.  There a preferred approach other than fork-change-pull request?

I’m the one who volunteered above to implement, this time actually signed in so I’m identified and can follow the topic.