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:
- install dbmigrate plugin
- configure the database connection to none
- create an initial changelog
- 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.