but I can perform rollback either using cmd or maven plugin. But the issue in my case is all thing packaged in an image and deployed. There is no system on which I can run these command. So how can I perform the rollback. Thanks in advance.
Hey sorry for resurrecting this old post. I believe you would need to have an image with liquibase on it (like this: https://www.liquibase.org/blog/using-liquibase-via-docker) and someway pass the project files (like changelog) and arguments (like rollback n-3rd changeset). You can do this is docker by running the liquibase command in the image’s docker cli.
I know this is old but new people might want to check it out for reference.
A couple of points…
I would recommend that you “fix forward” rather than roll back your changes.
This has the benefit of being easier to deploy when using CI/CD systems and
processes. “Always Moving Forward” is our motto when using Liquibase.
Here is a great article that goes over the differences between the approaches:
Also, I would recommend that you decouple your container build from your
working schema changelog/changesets by mounting it as the working directory.
We build out the container with all of the pieces you need (pt-osc, etc.) and
then reference the custom container in a docker-compose located in the scm repo
for the changelog/changesets.
Snippet of docker-compose.yml:
liquibase: image: company_name/our-liquibase-container container_name: liquibase entrypoint: - /bin/bash tty: true volumes: - ./:/wd working_dir: /wd links: - db
With this setup you can bring your containers up with
docker-compose up -d and
then run commands like
docker exec container_name liquibase updatesql. You can use
this method to execute on whichever system you like – be it automated like jenkins or even
on your workstation directly, should you still need to roll back.
I hope this is clear… At some point I’ll write a blog post on exactly how we
built our systems to handle ci/cd at the database level.