Autobase Plugin

Get migrations to run before sessionFactory so dbCreate = 'validate' will work

Details

  • Type: Improvement Improvement
  • Status: Closed Closed
  • Priority: Minor Minor
  • Resolution: Won't Fix
  • Affects Version/s: None
  • Fix Version/s: None
  • Component/s: None
  • Labels:
    None

Description

It would be nice to be able to set dbCreate to 'validate' on those environments where autobase is incharge of the schema.
Currently the migrations seem to run after the validate check is done and therefore sessionFactory initialisation fails.

Activity

Hide
Robert Fischer added a comment -

This is nontrivial. Since I tend to run Autobase under "update", we'll need some kind of switch. And that switch is going to basically require Autobase to run before the Hibernate plugin, which I'm not sure is supported by Grails in any way.

Show
Robert Fischer added a comment - This is nontrivial. Since I tend to run Autobase under "update", we'll need some kind of switch. And that switch is going to basically require Autobase to run before the Hibernate plugin, which I'm not sure is supported by Grails in any way.
Hide
Lee Butts added a comment -

It wouldn't need to run before the hibernate plugin as such, just before the applicationContext is initialised and the sessionFactory started.

Could you run the migration from a ServletContextListener instead of via the doWithApplicationContext hook?
Or even do it during doWithSpring before the appContext is started?

Out of interest, how do you get autobase to play nicely with dbcreate='update'?
When I start my app with an empty DB my migrations fail as hibernate gets in first and creates all the tables..

Show
Lee Butts added a comment - It wouldn't need to run before the hibernate plugin as such, just before the applicationContext is initialised and the sessionFactory started. Could you run the migration from a ServletContextListener instead of via the doWithApplicationContext hook? Or even do it during doWithSpring before the appContext is started? Out of interest, how do you get autobase to play nicely with dbcreate='update'? When I start my app with an empty DB my migrations fail as hibernate gets in first and creates all the tables..
Hide
Robert Fischer added a comment -

I code my migrations assuming Hibernate has already done its thing. That's how it plays nicely with dbCreate="update".

I could approach it that way – but if I do, I'll basically have the duplicate code in the current location (with some flag check) so it continues to work the current way, too. Like I said: nontrivial. Not impossible. Just nontrivial.

Show
Robert Fischer added a comment - I code my migrations assuming Hibernate has already done its thing. That's how it plays nicely with dbCreate="update". I could approach it that way – but if I do, I'll basically have the duplicate code in the current location (with some flag check) so it continues to work the current way, too. Like I said: nontrivial. Not impossible. Just nontrivial.
Hide
Lee Butts added a comment -

Agreed

Show
Lee Butts added a comment - Agreed
Hide
Burt Beckwith added a comment -

Project is abandoned

Show
Burt Beckwith added a comment - Project is abandoned

People

Vote (1)
Watch (1)

Dates

  • Created:
    Updated:
    Resolved: