liquibase/liquibase — pull request #67 by michaelnadel (2012-09-06 03:07:09+00:00)
Title: User-submitted feature: escaped changeLog params

I ran into an issue with Liquibase recently where I was trying to insert an HTML template into our database. The template includes the following variable (to later be interpreted by our web templating system):

`${user.name}`

This, unfortunately, is one of the standard Java properties. As such, Liquibase insists on resolving it to the user's ID who is executing the Liquibase command.

I tried a few hacks (e.g. setting `user.name` to `${user.name}`) but nothing worked.

I then looked at the source, and saw there's no way to escape changeLog parameters. So I'm submitting this feature.

I believe it's 100% backwards compatible. It is enabled via setting `-Dliquibase.enableEscaping=true`. When this property is either false or non-existent, the behavior of changeLog parameters is unaffected.

When enabled, you can escape a changeLog param by adding a colon before the key name. For example:

`${:user.name}` will be rendered into the SQL as such: `${user.name}`.

When I first cloned the repo I tried running `mvn test` to get a baseline, but I was getting test errors. As such, I'm submitting this patch having ran only `liquibase.changelog.ExpressionExpanderTest`.