A Few Built-in Automatic Syntax Modifications

I occasionally need to get a random number or the current time in my refactorings.  In MySQL these are RAND() and CURRENT_TIMESTAMP, but in the other DBMSs it is slightly different.  It would be convenient to be able to put something like LIQ-RANDOM-NUMBER and LIQ-CURRENT-TIMESTAMP into my changesets and let liquibase do the substitutions for me.  (see http://www.statemaster.com/encyclopedia/Comparison-of-SQL-syntax for a nice comparison of a lot of the different syntax).  I’m sure there are other simple commands that 99% of DBMSs have.

Right now I’m planning on using the modifySql tag, but that gets a little messy.

That would be a good idea.  IIRC there you are able to pass in NOW or CURRENT_TIME or similar and it will convert it to the correct NOW() function, but more would be good.  I created an issue for it http://liquibase.jira.com/browse/CORE-444

modifySql does get a bit messy, but you should be able to do it.  You may be able to use changeLog paramemters http://www.liquibase.org/manual/changelog_parameters as well, depending on how you are calling liquibase.


Good idea.
CURRENT_TIME_UTC should also be considered. Sinse we have hosting many different places in the world, we prefer all times in UTC to avoid comparison confusion.