Database / Liquibase interview questions
What is a changeSet in Liquibase and how is it identified?
A changeSet is the atomic unit of change in Liquibase — it contains one or more related database operations (create table, add column, insert data, etc.) that should be applied together as a single migration step. Each changeSet is uniquely identified by the combination of three attributes: id, author, and the changeLog file path. Liquibase uses this three-part key to track whether a given changeSet has already been applied in a particular database.
The id is a free-form string — it can be a sequential number (1, 2, 3), a timestamp (20240115-001), or a descriptive slug (add-email-column). The author is usually the developer's name or username. The file path is recorded automatically from the location of the changeLog file on the classpath or filesystem.
<changeSet id="20240115-add-phone" author="bob">
<addColumn tableName="customer">
<column name="phone" type="VARCHAR(20)"/>
</addColumn>
<rollback>
<dropColumn tableName="customer" columnName="phone"/>
</rollback>
</changeSet>A critical rule: once a changeSet has been applied to any database (especially production), you must never modify its content. If the content of an applied changeSet changes, Liquibase will detect a checksum mismatch on the next run and fail with an error, preventing the migration from running. To make a correction, you always add a new changeSet rather than editing an existing one. This immutability guarantee is what makes the change history trustworthy.
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...
