/database-operations-skills:liquibase-advanced-changelog-management-and-rollback-strategiesfrom database-operations-skills
Manages advanced Liquibase changelog operations including contexts, labels, custom rollbacks, and changelog organization for large-scale projects.
Ships in database-operations-skills. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
database-schema-migration-with-liquibase-and-flyway covers the basics of Liquibase changesets and when to make them reversible — this skill picks up where that leaves off, for a Liquibase deployment that has matured past "a handful of changesets" into a long-lived project with many contributors, multiple environments, and changes that need environment-specific targeting or genuinely custom rollback logic Liquibase can't auto-generate. It covers contexts and labels (Liquibase's two, distinct mechanisms for controlling which changesets apply where), writing custom rollback blocks for non-trivial forward changes, and changelog organization patterns that keep a large, multi-team changelog navigable and safe rather than a single ever-growing file nobody fully understands.
sql changeset, a stored-procedure change).liquibase status, liquibase history) after a confusing
deploy where an unexpected changeset ran (or didn't run) in a given
environment.DATABASECHANGELOG tracking table, and the forward-only-vs-reversible
decision already covered in
database-schema-migration-with-liquibase-and-flyway —
this skill does not re-explain those basics.labels: "!prod-only" style boolean expressions) is a 4.x
feature — verify syntax compatibility if working against an older
Liquibase version."staging", "stage",
"Staging" used inconsistently by different contributors) silently
fails to filter as intended, since context matching is exact-string,
not fuzzy.--contexts/--label-filter flag per target environment at deploy
time — the filtering only works if the deploy pipeline actually
specifies it; running liquibase update with no context flag applies
every changeset regardless of its context, which is rarely the
intended behavior for a context-scoped changeset.<changeSet id="42" author="team" context="staging,dev">
<insert tableName="feature_flags">
<column name="name" value="new_checkout_flow"/>
<column name="enabled" value="true"/>
</insert>
</changeSet>
liquibase update --contexts=staging
A changeset with context="staging,dev" runs when the deploy's
--contexts flag includes either staging or dev (comma-separated
contexts within one changeset are OR'd) — but the match itself is an
exact string comparison. --contexts=staging will not match a
changeset tagged context="Staging" or context="stage" — there is no
fuzzy matching, no case normalization guaranteed across all versions,
and this is the most common cause of "why didn't this changeset run"
confusion. Establish and document a small, fixed vocabulary of context
names used consistently across the whole team before contexts proliferate.
Liquibase 4.x also supports boolean context expressions for more precise targeting:
<changeSet id="43" author="team" context="staging and not smoke-test">
Labels and contexts solve related but distinct problems: contexts are typically environment/purpose-scoped ("run this in staging"), while labels are better suited to cross-cutting classification that doesn't map to a specific environment ("this changeset is part of release 2026.3" or "this changeset requires a maintenance window"):
<changeSet id="44" author="team" labels="release-2026.3,requires-downtime">
<dropColumn tableName="orders" columnName="legacy_status"/>
</changeSet>
liquibase update --label-filter="release-2026.3"
A common, effective pattern combines both: contexts gate where a
changeset can run, labels classify what kind of change it is for
reporting/auditing/selective-rollout purposes — e.g. running only the
changesets for a specific release that are also safe for the current
environment: --contexts=production --label-filter=release-2026.3.
Liquibase can auto-generate a rollback for simple, structurally
reversible changes (e.g. addColumn → dropColumn), but cannot for
data transformations, most sql/sqlFile changesets, or anything
whose forward operation isn't a pure structural inverse:
<changeSet id="45" author="team">
<sql>
UPDATE orders SET status = 'archived' WHERE created_at < '2024-01-01' AND status = 'completed';
</sql>
<rollback>
UPDATE orders SET status = 'completed' WHERE created_at < '2024-01-01' AND status = 'archived';
</rollback>
</changeSet>
This rollback is only a correct inverse because the forward
operation's WHERE clause was specific enough that no other process
could have set matching rows to 'archived' for a different reason in
the interim — a custom rollback is only as trustworthy as the
reasoning behind why it's a true inverse of the specific forward
change, not a generic-looking undo. For a genuinely irreversible
forward operation (a DROP COLUMN that deletes data, a destructive bulk
delete), write an explicit empty rollback with a comment explaining
why, rather than a rollback block that looks complete but can't restore
lost data:
<changeSet id="46" author="team">
<dropColumn tableName="orders" columnName="legacy_notes"/>
<rollback>
<!-- Intentionally irreversible: legacy_notes data is not recoverable
from this rollback. Restore from backup if this change needs
to be undone. See database-backup-and-restore-strategies. -->
</rollback>
</changeSet>
An explicit, documented empty rollback is safer than either an
auto-generated rollback that silently can't restore data, or no
<rollback> block at all (which causes liquibase rollback to fail
outright when it reaches this changeset, potentially mid-rollback-chain
during an incident when clarity matters most).
<!-- db.changelog-master.xml -->
<databaseChangeLog>
<includeAll path="changelogs/2025/" relativeToChangelogFile="true"/>
<includeAll path="changelogs/2026/" relativeToChangelogFile="true"/>
</databaseChangeLog>
changelogs/
├── 2025/
│ ├── 001-create-orders-table.xml
│ └── 002-add-orders-status-index.xml
└── 2026/
├── 001-add-payment-method-column.xml
└── 002-archive-legacy-orders.xml
includeAll processes files in a directory in (by default) alphabetical
order — a strict, predictable naming convention (a numeric or
date-based prefix) is what makes ordering deterministic and mergeable
across contributors working in parallel branches; without one, two
concurrently-authored files can merge cleanly in git but apply in an
unintended relative order. For a genuinely large multi-team project,
splitting by year/quarter (as above) or by service/schema-owning team
keeps individual files small and reduces merge conflicts on a single
shared master file, while includeAll's directory scan keeps the master
changelog itself simple and rarely needing edits.
liquibase status --contexts=staging
liquibase history
SELECT id, author, filename, dateexecuted, contexts, labels
FROM databasechangelog
ORDER BY dateexecuted DESC LIMIT 20;
DATABASECHANGELOG records the contexts/labels a changeset was
tagged with at the time it ran, which is the ground truth for "why did
(or didn't) this changeset apply here" — check this table directly
rather than only re-reading the changelog source, since the changelog
file may have been edited since (a changeset's tag metadata, unlike its
checksummed content, doesn't retroactively change what already ran).
<rollback> block — write an explicit, documented empty rollback
rather than letting liquibase rollback fail unexpectedly mid-chain
during an incident.WHERE/scope logic, not just its surface
resemblance to an "undo" — a rollback that looks plausible but
matches a broader or narrower row set than the forward change is a
data-integrity bug waiting to happen.includeAll-based changelog structure, and split large changelogs by
time period or owning team well before a single file becomes
unmanageable.DATABASECHANGELOG's recorded contexts/labels per applied
changeset as the audit trail for "what ran where and why," not just
the current changelog source.Symptom: A changeset tagged for a specific environment runs
anyway during a deploy that wasn't supposed to include it (or,
conversely, doesn't run when expected).
Fix: Context matching is exact-string — a typo or inconsistent
casing ("Staging" vs. "staging") between the changeset's context
attribute and the deploy's --contexts flag silently fails to match
with no error raised. Audit DATABASECHANGELOG.contexts for the
actual recorded value against the deploy pipeline's actual flag value,
and standardize on a documented, enforced vocabulary going forward.
Symptom: liquibase rollback fails partway through a multi-
changeset rollback chain, referencing a changeset with no rollback
defined.
Fix: A changeset (often one added later, without following the
team's rollback-authoring convention) has no <rollback> block at
all, and Liquibase has no auto-generatable inverse for its operation.
Add an explicit rollback (real or documented-empty) for every
changeset as it's authored — discovering a missing rollback mid-
incident, with a rollback chain already partially applied, is the
worst time to write one.
Symptom: A rollback that "looks correct" is run, and it restores
the wrong rows, or too many/too few rows compared to what the forward
changeset actually changed.
Fix: The rollback's WHERE/scope logic doesn't precisely mirror
the forward changeset's actual scope (e.g. the forward change had an
additional filter condition the rollback's inverse omitted). Review a
custom rollback's exact predicate logic against the forward
changeset's, not just its general shape, and test the rollback
against a copy of the same data state the forward changeset was
tested against.
Symptom: Two contributors' changesets, each individually correct
and merged cleanly in version control, apply in an unexpected relative
order in a shared environment, and the second one fails because it
assumed the first had already run.
Fix: includeAll's directory-scan ordering (typically
alphabetical) doesn't guarantee the order two concurrently-authored
files were intended to run in unless a strict, enforced naming
convention (numeric/date prefix) makes that order unambiguous and
git-mergeable. Adopt and enforce such a convention, and validate the
full changelog's actual apply order in CI against a fresh database
before merge — consistent with the CI validation discipline in
database-schema-migration-with-liquibase-and-flyway.
Symptom: Someone runs liquibase rollback-count 5 (or an
equivalent bulk rollback) directly against production during an
incident, without first confirming each of those five changesets'
rollback definitions are genuinely safe and reversible.
Fix: A bulk rollback applies every changeset's <rollback> block
in reverse order without individually re-confirming each one is a true
data-preserving inverse — if even one of those five includes a
documented-irreversible empty rollback (or, worse, an incorrect
auto-generated one for a change that wasn't truly reversible), the
bulk rollback silently doesn't restore what someone assumes it does.
Warning — potentially destructive/incomplete action. Before any bulk rollback against production, review each affected changeset's actual rollback definition individually (not just trust the command succeeded), and confirm a tested, verified backup exists as the real fallback — see database-backup-and-restore-strategies — for any changeset in the rollback range whose forward operation was genuinely destructive.
Scenario: A payments platform's Liquibase changelog has grown to over 300 changesets in a single flat XML file across three teams, with recurring confusion about which changesets are safe to run in staging versus production, and a recent incident where a rollback failed partway through because an older changeset had no rollback defined.
includeAll-based structure with a strict
NNN-description.xml naming convention per directory, validated in
CI to apply cleanly in the enforced order against a fresh database.production, staging, dev) and a separate label convention for
release tracking (release-YYYY.Q), auditing the existing 300
changesets for inconsistent context strings (finds several instances
of "Staging" and "stage" that had been silently not matching
--contexts=staging deploys) and correcting them.<rollback> blocks; for
genuinely irreversible ones (a handful of historical DROP COLUMN
operations), add explicit documented-empty rollbacks referencing the
team's backup/restore runbook instead of leaving them undefined.UPDATE
archiving old orders) whose rollback had caused the recent incident,
rewrite its rollback to precisely mirror the forward changeset's
WHERE clause, and add a test in CI that applies the changeset,
applies the rollback, and asserts the resulting data state exactly
matches the pre-changeset state.--contexts and
--label-filter flags per environment (never relying on the
default, unfiltered liquibase update), and add a pre-deploy check
that fails the pipeline if any changeset in the current release's
label has no rollback defined.What SKILL.md sets; muted values are Claude Code's defaults
23 skills in this plugin
/arangodb-multi-model-database-operationsCovers operating ArangoDB, a multi-model database combining document, graph, and key-value collections in a single engine with a unified query language (AQL): collection type selection, graph traversal via AQL, and cluster configuration (coordinators, DB-servers, agency). Use when the user asks to "write an AQL query," "should I use a document or edge collection in ArangoDB," "set up an ArangoDB cluster," "why is this AQL graph traversal slow," or "choose between ArangoDB and a single-purpose database for a mixed graph/document workload."
/cassandra-wide-column-database-operationsCovers Apache Cassandra ring topology and token/partition design, tunable consistency levels (ONE, QUORUM, ALL, LOCAL_QUORUM), compaction strategy selection (SizeTiered, Leveled, TimeWindow), and tombstone/GC-grace management. Use when the user asks to "design a Cassandra partition key," "choose a Cassandra consistency level," "why is this Cassandra query slow," "pick a compaction strategy," "Cassandra tombstone warnings in logs," or "add/remove a node from a Cassandra ring."
/clickhouse-analytical-database-operationsCovers operating ClickHouse, the leading open-source OLAP columnar database: MergeTree engine family selection (MergeTree, ReplacingMergeTree, AggregatingMergeTree, SummingMergeTree), sharding and replication topology via ReplicatedMergeTree and Distributed tables, and materialized views for streaming aggregation. Use when the user asks to "set up a ClickHouse cluster," "pick a MergeTree engine," "why are my ClickHouse queries slow," "shard and replicate ClickHouse tables," "deduplicate rows in ClickHouse," or "build a ClickHouse materialized view for rollups."
/cloud-data-warehouse-operations-snowflake-bigquery-redshiftComparative operations guide for the three dominant managed cloud data warehouses: Snowflake virtual warehouse sizing and multi-cluster scaling, BigQuery slot allocation and on-demand vs. capacity pricing, and Redshift cluster/RA3 node sizing and workload management (WLM) — plus cost-control and query-performance practices common to all three. Use when the user asks to "size a Snowflake warehouse," "control BigQuery query costs," "tune Redshift WLM queues," "why is this warehouse query slow," "reduce our data warehouse bill," or "choose between Snowflake, BigQuery, and Redshift."
/database-backup-and-restore-strategiesCross-database backup tooling and restore-testing discipline: pg_dump/pg_basebackup for PostgreSQL, mysqldump/Percona XtraBackup for MySQL/MariaDB, and mongodump/mongorestore for MongoDB — logical vs. physical backup trade-offs, point-in-time recovery, and why an untested restore is not a real backup. Use when the user asks to "set up database backups," "restore from a pg_basebackup," "why did our mysqldump restore fail," "test our backup/restore process," "set up point-in-time recovery," or "design a backup retention policy."
/database-connection-pooling-strategiesCross-database connection pooling patterns and tooling: PgBouncer for PostgreSQL, ProxySQL for MySQL/MariaDB, and the shared design questions (transaction vs. session vs. statement pooling modes, backend pool sizing, failover-aware routing) that apply regardless of the underlying database engine. Use when the user asks to "size a connection pool," "choose between transaction and session pooling," "set up ProxySQL for MySQL," "why do prepared statements break under pooling," or "route reads/writes through a proxy during failover."
npx claudepluginhub selvarajmurugesan90/ops-engineering-skills --plugin database-operations-skillsOther plugins' skills for the same job