prompt

Database Migration Planner

Plans a safe database schema migration with steps, rollback, and zero-downtime considerations.

VettedUpdated June 2026
The prompt
Plan a database migration: {{change}} on table {{table}}. Give an ordered set of steps that avoids downtime (for example expand then contract), the rollback plan for each step, how to backfill existing rows, and what to verify before and after. Note any locking risk.
Did it work? Rate this prompt

Variables

changeChange
tableTable

Example output

Change: add a non-null currency column to orders. Steps (expand then contract): 1) add the column as nullable with a default — no lock on most engines. 2) backfill existing rows in batches to avoid long locks. 3) deploy app code that writes the column. 4) add the not-null constraint once all rows are populated. Rollback: each step reverses cleanly — drop the constraint, then the column. Verify before: row count and a sample. Verify after: no nulls remain, app reads and writes succeed. Locking risk: adding not-null directly would scan the whole table — that is why it is the last step.

Details

Author

AI Khazna

License

Security

Vetted

Type

prompt

Related assets

More curated picks in Development & Code.

Audit before you install

Run any source through our checks - AI visibility, security, performance, and stack detection.

More in Development & Code