grails-database-migration icon indicating copy to clipboard operation
grails-database-migration copied to clipboard

dbm should run before quartz/schwartz plugins

Open erichelgeson opened this issue 8 years ago • 3 comments

I recently dropped my database (hadn't since Grails 3.1.x) and re-started from scratch. Quartz would not start up due to no tables being created. This was due to dbm not running before to create the tables. I disabled quarts and let it dbm run, then re-enabled quartz and all was fine.

Should this constraint go in dbm or the respective plugins? eg: https://github.com/grails-plugins/grails-quartz/blob/0e2a909936afeab9322035e1a5da84ef3700ebfd/src/main/groovy/quartz/QuartzGrailsPlugin.groovy#L49

erichelgeson avatar Jan 20 '17 14:01 erichelgeson

I'm not sure making a change for loadAfter/loadBefore would have any effect, however you could give it a try locally and report back. I would think the change should go in the quartz plugin since it is the one with the issue.

jameskleeh avatar Jan 20 '17 14:01 jameskleeh

You're correct - the load* list didn't change the behavior. Is there a way to ensure dbm is run early to create tables for plugins that depend on them?

erichelgeson avatar Jan 20 '17 15:01 erichelgeson

I know this ticket is old, but in case anyone needs a work-around:

  • Disable quartz auto-startup in application.yml/application.groovy by setting quartz.autoStartup to false
  • Inject the quartzScheduler bean into BootStrap.groovy and inside the init closure run quartzScheduler.start() or quartzScheduler.startDelayed().

We delay the quartz scheduler for other reasons but as far as I know both methods should work. This is how we worked around this issue.

joemccall86 avatar Mar 01 '18 22:03 joemccall86