Auto rollback liquebase migrations when deploy old Spring Boot app version

Viewed 481

I am developing a rollback plan for my application. And I faced some difficulties with automating this process for database changes. In general, I build and deploy an artefact(Spring Boot fat jar) using ansible and have versions like app-1.5.0.jar.

When I rollback my app(I deploy 1.4.0, when the current version is 1.5.0), I would expect liquibase to rollback all migrations that were added in 1.5.0. However, I didn't find an automated way to do it.

Nevertheless, Spring Boot can generate the file that can be used for such purpose:

liquibase:
  rollback-file:

But it still requires me to manually run the SQL.

Is there a way I can run rollback DB automatically if some new migrations are missing the same way Spring Boot runs the migration for new changesets to be applied while deploying?

0 Answers
Related