views:

489

answers:

2

Hi,

There are at least two Grails plugins that emulate the database migration functionality of Rails.

Is there a consensus about which of these is best, or is there another plugin that does database migration which is better than either of the above?

Thanks, Don

+2  A: 

I use Autobase (which is built on top of Liquibase) as it (last time I checked) allows you to automatically check/apply your migrations when the app starts. With the Liquibase plugin I has to do this myself in servlet init code. This allows you to set your datasource to dbcreate = none and let Autobase handle getting the DB into shape.

It does mean you need to write a migration each time you add a property to a domain class but I think this is a good thing as it makes you think about what the underlying field should actually be instead of just letting Hibernate take a guess at it.

I think some of autobase (e.g. the groovy dsl) is being migrated back to Liquibase but you'd need to check up on that.

The only downside to Autobase is the lack of good doco (there is some but it's not complete). Luckily the dsl is the same as the xml Liquibase tags so you can work most of it out.

cheers

Lee

leebutts
just looking at the autobase page - it is now deprecated in favour of Liquibase
Bill Comer
I don't think liquibase has the ability to update the DB when your app starts which is a really good feature. I'd still use Autobase until migrations are part of Grails core (which is scheduled for Grails 1.4)
leebutts
+1  A: 

I use liquibase, I'm not sure that Robert is still actively maintaining Autobase and the xml that liquibase provides is actually pretty DSL-like. I think it also gives a little bit of separation to your database commands and doesn't make it ingrained into the start-up process (some people might prefer the reverse).

Ted Naleid