SkillVaultskills Browse all 500 skills

Data · Version 1.1.0 · Reviewed 2026-08-02

Database Migration Safety Reviewer

Make data systems more correct and operable for lock impact review and backfill race analysis with evidence, explicit trade-offs, and a verification plan.

4 method steps 7 documented failure modes 5 diagnostic checks 7 quality gates

Reviews schema migrations for locking behavior, rollback viability, backfill races, and compatibility during partial deployment.

₹149 one-time

Get this skill archive

What this skill helps you do

  • Lock impact review
  • Backfill race analysis
  • Rollback viability

How Database Migration Safety Reviewer works

You provide

Migration SQL, table sizes, and the deploy order

It inspects

Lock mode, duration at production scale, backfill batching

It decides

Safe sequence with expand-migrate-contract staging

You verify

Rehearsal timing on a restored production-sized copy

What it checks first

Database Migration Safety Reviewer reviews schema migrations for locking behavior, rollback viability, backfill races, and compatibility during partial deployment. Use it when the work involves Lock impact review, Backfill race analysis, Rollback viability.

  1. The lock mode each statement takes and its duration at production row counts, not sample counts.
  2. Whether the migration is backward compatible with the currently running application version during rollout.
  3. Whether a backfill runs in one transaction, which holds locks and snapshots for its entire duration.
  4. Whether the change is reversible, and specifically whether rollback remains possible after partial deployment.
  5. Ordering relative to the code deploy: schema-first and code-first fail differently.

Failure modes it recognizes

  • Adding a `NOT NULL` column with a volatile default forcing a full table rewrite under an exclusive lock.
  • A single-statement backfill holding a transaction open long enough to block vacuum and inflate bloat.
  • Renaming a column, which is instantly breaking for any running instance of the previous code version.
  • A backfill racing live writes and overwriting newer values with stale computed ones.
  • Adding a unique index non-concurrently and blocking writes for the entire build.
  • Dropping a column that a replica or read-only reporting query still references.
  • Changing a column type, which rewrites the table and invalidates dependent views and indexes.

Answers it will reject

  • Testing the migration only on a development database, where the table is small enough that lock duration is invisible.
  • Combining a schema change and a data change in one transaction, which maximizes lock hold time.
  • Assuming rollback is available without verifying that the previous code version works against the new schema.
  • Running a migration during peak traffic because "it is only a small change".

Decision rules it applies

  • Use expand-migrate-contract: add the new shape, dual-write, migrate readers, then remove the old shape in a later release.
  • Batch every backfill with an explicit batch size, a sleep, and a resumable cursor.
  • Set `lock_timeout` on every migration so it fails fast rather than queuing behind a reader.
  • A migration is only approved if the previous application version still functions against the new schema.

Evidence it asks for

  • Estimate duration by running the migration against a production-sized restored copy and recording wall time.
  • Inspect the lock mode with `pg_locks` during a rehearsal rather than reasoning from documentation alone.
  • Verify the backfill with row counts and checksums between old and new representations before contracting.

The method inside

  1. Map the artifact, actors, boundaries, and invariants relevant to lock impact review.
  2. Trace concrete failure or abuse paths for backfill race analysis; do not report checklist items without a mechanism.
  3. Prioritize rollback viability findings by impact, likelihood, confidence, and cost of correction.
  4. Recommend the smallest defensible change, then define how an independent reviewer can verify it.

Deliverables

  • Lock impact review assessment
  • Backfill race analysis decision and action plan
  • Rollback viability verification checklist

Evidence requirements

  • Schema, access patterns, query plans, or event contracts
  • Volume, cardinality, retention, and freshness
  • Consistency, latency, and migration constraints

Quality gates

  • Every material claim traces to supplied evidence or is labeled as a hypothesis.
  • The response follows the declared deliverable contract.
  • No execution, access, measurement, or verification is invented.
  • Secrets and personal data are redacted rather than repeated.
  • The user receives a concrete independent verification step.
  • The relevant failure modes in this domain were considered rather than only the reported symptom.
  • No listed anti-pattern was recommended as a solution.

Example task

Input

Review this migration that adds a NOT NULL column with a default and backfills 80 million rows before we run it in production.

Expected output

Two separate risks here. The NOT NULL default is safe on PostgreSQL 11+ but rewrites the table on older versions, and your backfill runs as a single statement that will hold a transaction open for the entire duration. Batch the backfill and add the constraint as NOT VALID first, then validate separately...

Boundaries and compatibility

Ideal for

  • Lock impact review: produce a decision or artifact grounded in supplied evidence.
  • Backfill race analysis: produce a decision or artifact grounded in supplied evidence.
  • Rollback viability: produce a decision or artifact grounded in supplied evidence.

Out of scope

  • Recommending indexes without a workload
  • Treating eventual consistency as universally acceptable

Agent compatibility

  • GitHub Copilot custom agents
  • Claude Agent Skills / SKILL.md
  • Any instruction-following chat model

Tool policy: Advisory by default. No tools are assumed. If the host provides tools, use read-only evidence gathering unless the user explicitly approves a scoped write or execution action.