Bootstrap Liquibase in your Grails app

Grails has had a liquibase plugin for a long time (note: I am talking about the old liquibase plugin based on 1.9). One functionality that (I feel) it's missing is a proper Bootstrap hook so that database changes can be deployed right when the application starts. The newest liquibase plugin called grails database migration has it built in.



This is especially handy when running integration tests as the database can be brought up-to-date without calling any grails script, but will run from within the application as it starts up instead.

I use the liquibase plugin with the XML changelog format, to maximize compatibility, and I have now decided that I have had enough of running grails scripts whenever I change something. Well, actually, I have had enough of having to remember to run it.

So I'd like to share with you my Bootstrap code with liquibase plugin integration. If running liquibase in production automatically makes you nervous you can leave it out (use an if, or a separate section).