Database Migration Plan Builder

Document a database schema migration with steps, validation, and rollback

Builds a database migration plan with pre-migration checks, ordered migration steps and SQL, an estimated duration, post-migration validation queries, and a rollback script outline you can paste into a runbook.

Why write a migration plan instead of just running the SQL?

A written plan forces you to think through pre-checks, ordering, validation, and rollback before touching production. It also gives reviewers and on-call engineers a runbook to follow if something goes wrong at 3am.

Turn a risky schema change into a repeatable runbook

Schema migrations are one of the highest-risk things you can do to a production system: get the ordering wrong, skip a backfill, or forget a rollback and you can corrupt data or lock a table for minutes. This builder structures the change into a runbook — pre-checks, steps, validation, and rollback — so the plan is reviewable before anyone runs it.

How it works

You describe the migration name, target table, and engine, then list pre-migration checks, the forward SQL steps, validation queries, and rollback SQL. The tool assembles a Markdown runbook with numbered phases following the expand-and-contract mindset: verify preconditions, apply changes in order, validate the result, and keep a tested rollback ready. The estimated-duration field reminds you to rehearse on staging so the production window is realistic. Nothing is executed — the output is a document you paste into your deployment process.

Tips and example

  • Prefer additive steps first: ALTER TABLE users ADD COLUMN email_verified BOOLEAN DEFAULT false; is safe and non-locking on most engines.
  • Backfill in batches for large tables to avoid long locks, e.g. update 10,000 rows per statement in a loop.
  • Write validation queries that compare counts before and after, such as SELECT count(*) FROM users WHERE email_verified IS NULL;.
  • Keep the rollback in the same plan and test it on staging — an untested rollback is not a rollback.