PromptDev

Write a migration plan

A prompt for turning a schema or API change into a phased expand-migrate-contract plan, each phase deployable and reversible alone.

Last updated

Fill in the blanks

Assembled in your browser — nothing you type is stored or sent anywhere.

Your prompt

Write a migration plan for this schema or API change: rename the users.email column to users.contact_email. Constraints: zero downtime, can't take the primary offline, roughly 2M rows. Structure the plan in the expand-migrate-contract pattern: Expand (add the new shape alongside the old, additive only), Migrate (backfill data and move readers and writers to the new shape, with the old shape still present as a fallback), Contract (remove the old shape once nothing depends on it). Each phase must be independently deployable and safe to leave running for days if the next phase is delayed. For every phase, state the rollback: what it takes to revert just that phase without touching data written by later phases. If a phase can't be made backward-compatible under the stated constraints, say which one and why, instead of presenting a plan that quietly assumes downtime is acceptable.

Model-agnostic — works in Claude, ChatGPT, Gemini or any AI chat.

Why this prompt works

  • Enforcing expand-migrate-contract as the structure rules out the default unsafe plan: a single deploy that renames or drops something while old code paths are still reading it.
  • Requiring each phase to survive being "left running for days" targets real deploys, where phases don't happen back-to-back and one that only works if the next lands immediately will break.
  • A rollback stated per phase, scoped to leave later phases' data untouched, is what makes the plan actually reversible rather than reversible in theory — it matters exactly when something goes wrong mid-migration.

Related in Prompts