Grails Database Reverse Engineering Plugin
Tuesday, November 09th, 2010Support for database migrations and reverse engineering are two related features that we’ve scheduled for Grails 1.4/2.0 (see the roadmap wiki page
for the others). The migration support will be based on Liquibase
and there’s already a plugin for that
so I started looking at reverse engineering first.
Work progressed faster than I expected (thanks to the features of the Hibernate Tools library and all of the time I spent digging into its internals for the App Info
plugin) and it didn’t depend on any new features in 1.4 (not yet anyway) so I released the plugin
yesterday so users can started using it now. Install it the usual way:
and refer to the documentation for configuration options.
I tested this with MySQL and Oracle, and other databases that Hibernate supports should work too. There’s a tutorial in the documentation that uses MySQL, and you can use the Chinook database to test with Oracle. I used these settings (in
grails-app/conf/Config.groovy
) for the Chinook database:
grails.plugin.reveng.packageName = 'com.codeplex.chinookdatabase' grails.plugin.reveng.defaultSchema = 'CHINOOK' grails.plugin.reveng.manyToManyBelongsTos = [PLAYLISTTRACK: 'PLAYLIST']
and these datasource settings (in grails-app/conf/DataSource.groovy
)
dataSource { url = 'jdbc:oracle:thin:@localhost:1521:orcl' driverClassName = 'oracle.jdbc.driver.OracleDriver' username = 'chinook' password = 'p4ssw0rd' dialect = org.hibernate.dialect.Oracle10gDialect }
Try it out and report any issues on the Grails user mailing list or in JIRA
.
One related thing I wanted to point out is that the work to replace HSQLDB with H2



http://localhost:8080/appname/dbconsole
in a browser (JIRA issue here