How to run Grails Database Migration after startup -
for integration tests load 'seed' database in bootstrap.groovy. manually load different databases time time during development try out different scenarios.
trouble is, database migration plugin (many bert!) seems run during startup, before getting bootstrap code , can't see anywhere can trigger run again.
which means if load db 'out of date' have shut down app , restart migration done. have remember take snapshot of 'new' database don't have again next time.
all of hits productivity, across multiple refactorings.
are there better ways of doing this? ideally i'd service class method 'runmigrations()' or something. call after loading tools or within bootstrap code.
any ideas?
it possible , valid use case in opinion, e.g. run specific contexts after application has been started:
import grails.plugin.databasemigration.migrationutils import liquibase.liquibase class databasemigrationservice { def runmigrationsforcontexts(string contexts) { def database = migrationutils.getdatabase() liquibase liquibase = migrationutils.getliquibase(database) liquibase.update(contexts) } }
Comments
Post a Comment