When to execute Liquibase update

Viewed 432

I have added Liquibase to my application which is an EAR running on JBoss EAP 6. I use Maven as a build tool. I'd like to know what is the preferred way to run the Liquibase update. Currently I use liquibase CDI and the database update is executed when the application starts.

What approach do you guys use? Maven plugin, CDI, ServletListener, ...

Thanks for your answers

Pavel

1 Answers

It depends very much on your application requirements. If your database changes are applied quickly enough and such delay in startup is fine it is easy to go with database migration step as a part of application startup with any of startup listener as a trigger.

If you need to deploy database changes separatelly from application deployment (for example, it is one by separate teams or you run database migration before application release to reduce downtime because of long operations) than you should choose one of other approaches: run liquibase jar using script, run a maven step (if you are deploying with it) or something else.

Related