Short intro to grails database migration

| No Comments | No TrackBacks

I just started using the database-migration plugin inside a grails project and the documentation is not very concise. This short intro isn't meant to cover a lot of functionality, it's more like a quick reference. So here are a few steps on how to get started:

  1. install dbmigrate plugin
  2. configure the database connection to none
  3. create an initial changelog
  4. apply changes to database

To create an initial changelog run the following command:
grails dbm-generate-gorm-changelog changelog.groovy
This will generate a changelog based on your current object model

grails dbm-update will update your database to the current level of your object model.

If late on you make changes that affect the database, run
grails dbm-gorm-diff --add changelog.groovy

This will create a new changeset and automatically add it to the global changelog. Running the above command without any parameters will dump the changes to the console for easy review.

When you're satisfied with the result, you can run dbm-update again to sync your db.

I will try to cover some more ground when I have time.

No TrackBacks

TrackBack URL: http://thomasjaehnel.com/cgi-bin/mt/mt-tb.cgi/65

Leave a comment


Click here to add a video comment!

About this Entry

This page contains a single entry by Thomas Jaehnel published on May 28, 2011 12:26 AM.

Creating an EBS boot image from instance-store AMI was the previous entry in this blog.

DynDNS replacement via AWS route 53 is the next entry in this blog.

Find recent content on the main index or look in the archives to find all content.

Creative Commons License
This blog is licensed under a Creative Commons License.
homemade code GmbH
powered by homemade code GmbH ~ the application security experts!