0

I'm using the database migration plugin in my app but im having issues when using other plugins that have DB schema dependencies.

I want to use the migrations plugin to setup / refactor my DB in preparation for using a freshly installed plugin (e.g. taxonomy plugin). The problem is that the migrations plugin loads after other plugins so my application is failing before I can even run the migration (schema dependencies not applied). It would seem reasonable to me that DB migrations should run before other plugins (in 99% of cases). Correct?

Is there a way (without customising the migration plugin with "def loadBefore") to force the migrations plugin to load first?

Thanks

tinny
  • 4,232
  • 7
  • 28
  • 38

1 Answers1

1

Unfortunaltely a plugin's dependsOn and loadAfter properties are set by the plugin developer.

However, you could create a new environment, and use the following config property grails.plugin.excludes to exclude a number of plugins.

Basically I would define a grails environment used for database migration. I would define a datasource for this environment, and in Config.groovy:

environments {
  prodMig {
    grails.plugin.excludes = 'interferingPlugin1,interferingPlugin2'
  }
}

this would exclude plugins interfering-plugin1 and interfering-plugin2 from your prodMig environment.

Then you can run your databse migration command like this:

grails -Dgrails.env=prodMig dbm-update
Luis Muñiz
  • 4,649
  • 1
  • 27
  • 43