Prompt LibraryEngineering

Database Schema Migration Planner Prompt

Plan a zero-downtime migration from old to new schema.

The prompt

Plan a zero-downtime migration from the current schema to the target schema.
Provide the SQL for each step, in order, with:
- Backfill strategy.
- A deploy-safe order (add column → backfill → dual-write → switch → drop old).
- Rollback SQL for each step.
- When it is safe to run each step (off-peak, locked table, etc.).

Current schema:
{{current}}
Target schema:
{{target}}

Replace the {{fields}} with your own context and tighten the rules to match your domain.

Share this prompt