Grails database migration plugins
Asked Answered
C

6

11

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 better than either of the above?

Cheri answered 20/1, 2010 at 17:54 Comment(0)
M
13

There is now a standard Grails database migration plugin available. According to this blog post at least the liquibase plugin will therefore not be maintained past the liquibase 1.9 release anymore.

The new database migration plugin has built-in functionality to execute changelogs on startup and supports the definition of changes in Groovy DSL, so it's probably what you are looking for.

Morbific answered 23/1, 2011 at 8:13 Comment(0)
O
3

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 have 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 the Autobase plugin (e.g. the groovy dsl) is being migrated back to the Liquibase plugin, but you'd need to check up on that.

The only downside to Autobase is the lack of good documentation. 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.

Odle answered 20/1, 2010 at 22:23 Comment(3)
just looking at the autobase page - it is now deprecated in favour of LiquibaseRinarinaldi
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)Odle
@Odle - As of this writing, the dbMigrations plugin (the successor to the Liquibase plugin) does support updating the DB on application start.Larsen
O
1

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).

Outflow answered 21/1, 2010 at 5:7 Comment(0)
C
1

At least as of Grails2.0, the database migration plugin is the defacto way to handle non-trivial database changes. The plugin is built on Liquibase, and is authored by the Springsource folks - always a mark of quality. I wrote an introduction to the database migration plugin which might be of use to someone reading this.

Chantel answered 23/10, 2012 at 8:20 Comment(0)
B
0

I have heard that Autobase is still maintained, but consider that the Grails Database Migration Plugin is written by the core team, and likely going to be the officially supported one.

In other words, encourage you can wait on Grails 1.4 --> roadmap before choosing either of the plugins above.

Brom answered 27/1, 2011 at 7:51 Comment(0)
C
0

YEs i also see the migration pluging. This is helpful... http://grails-plugins.github.io/grails-database-migration/

Collaborative answered 2/3, 2014 at 7:24 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.