Table of Contents
LiquiBase Grails Integration
LiquiBase can be used as a Grails plug-in. To install, simply run grails install-plugin liquibase and create your change log XML file in grails-app/migrations/changelog.xml
Is there a non-XML way to write change logs?
Currently not, althouh we are working on a LiquiBase domain specific language alternative to XML. If you really don't like working with XML, you may want to look at the LiquiBase IDE or Eclipse Plugin
Update/Rollback Commands
| migrate | Updates database to current version |
|---|---|
| migrate-sql | Writes SQL to update database to current version to STDOUT |
| migrate-count <num> | Applies NUM changes to the database |
| migrate-count-sql <num> | Writes SQL to apply the next NUM changes to STDOUT |
| rollback <tag> | Rolls back the database to the the state is was when the tag was applied |
| rollback-sql <tag> | Writes SQL to roll back the database to that state it was in when the tag was applied to STDOUT |
| rollback-count <num> | Rolls back the last <value> change sets applied to the database |
| rollback-count-sql <num> | Writes SQL to roll back the last “num” change sets to STDOUT applied to the database |
| rollback-to-date <date> | Rolls back the database to the the state is was at the given date/time. Date Format: yyyy-MM-dd HH:mm:ss |
| rollback-to-date-sql <date> | Writes SQL to roll back the database to that state it was in at the given date/time version to STDOUT |
| future-rollback-sql | Writes SQL to roll back the database to the current state after the changes in the changeslog have been applied |
Misc Commands
| db-doc | Generates Javadoc-like documentation based on current database and change log |
|---|---|
| generate-changelog | Writes Change Log XML to copy the current state of the database to standard out |
Maintenance Commands
| tag | 'Tags' the current database state for future rollback |
|---|---|
| changelog-sync-sql | Writes SQL to mark all changes as executed in the database to STDOUT |
| clear-checksums | Removes all saved checksums from database log. Useful for 'MD5Sum Check Failed' errors |
| drop-all | Drop all database objects owned by user |
| list-locks | Lists who currently has locks on the database changelog |
| release-locks | Releases all locks on the database changelog |
| status | Outputs list of unrun changesets |
| validate-changelog | Checks changelog for errors |
Version Naming Convention
The Grails plugin is versioned based off the core LiquiBase version. For example, a Grails plug-in version of “1.3.2.0” is the first Grails plug-in release based on the 1.3.2 version of LiquiBase. If there is a patch to the Grails plug-in, but not the core LiquiBase library, the version will change to “1.3.2.1”.
