Grails database migration plugins

前端 未结 6 1654
星月不相逢
星月不相逢 2021-02-14 06:55

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

  • Autobase
  • Liquibase

Is there a consensus a

相关标签:
6条回答
  • 2021-02-14 07:16

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

    0 讨论(0)
  • 2021-02-14 07:18

    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.

    0 讨论(0)
  • 2021-02-14 07:26

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

    0 讨论(0)
  • 2021-02-14 07:27

    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.

    0 讨论(0)
  • 2021-02-14 07:33

    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.

    0 讨论(0)
  • 2021-02-14 07:36

    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.

    0 讨论(0)
提交回复
热议问题