Showing posts from September, 2012

Database migrations in Grails

When you make changes to a domain class (like adding an extra field) in your Grails application, and then deploy to production, that change is usually propagated out to the corresponding table in the database. That you don't have to manually update the structure of your table is thanks to some Hibernate magic, but this magic in not always enough. It is (rightly so) conservative in nature, and it won't perform a potentially high risk change - such as the dropping of a column - automagically. So you are left with two options. The first is to perform these higher risk changes manually, and the second is to start using the database migrations plugin.
Introduction This plugin is part of a new set of integral plugins (like resources) maintained by the leaders of the Grails community. There are already some useful articles on using the database migration plugin, but one more can't hurt! Like many aspects of the Grails ecosystem, once you grok how to use this plugin, you will see…