Database / Liquibase interview questions
What are Liquibase tags and how do you use rollback to a tag?
A tag in Liquibase is a named marker you apply to the current state of DATABASECHANGELOG — a named checkpoint that records exactly which changeSets have been applied at the time of tagging. Tags are used as rollback targets: instead of counting changeSets or specifying a date, you roll back to a named release like v2.3.0.
You create a tag in two ways:
Via the CLI before a deployment:
liquibase tag v2.3.0Inline in the changeLog using the tagDatabase change type:
<changeSet id="tag-v2.3.0" author="release-bot">
<tagDatabase tag="v2.3.0"/>
</changeSet>Including the tag as a changeSet is the preferred approach in automated pipelines because it ensures the tag is always created at exactly the right point in the changeLog regardless of when the deployment runs. The CLI approach requires the operator to run the tag command before the update, which is easy to forget.
To roll back to a tag:
liquibase rollback v2.3.0This reverses all changeSets applied after the tag point, in reverse order. Before executing, you can preview what would happen:
liquibase rollbackSQL v2.3.0A good practice for CI/CD pipelines is tagging the database with the release version at the start of every deployment. If the deployment fails partway through, rolling back to the previous tag restores the exact schema that was stable before the release.
Invest now in Acorns!!! 🚀
Join Acorns and get your $5 bonus!
Acorns is a micro-investing app that automatically invests your "spare change" from daily purchases into diversified, expert-built portfolios of ETFs. It is designed for beginners, allowing you to start investing with as little as $5. The service automates saving and investing. Disclosure: I may receive a referral bonus.
Invest now!!! Get Free equity stock (US, UK only)!
Use Robinhood app to invest in stocks. It is safe and secure. Use the Referral link to claim your free stock when you sign up!.
The Robinhood app makes it easy to trade stocks, crypto and more.
Webull! Receive free stock by signing up using the link: Webull signup.
More Related questions...
