SQL Migration Reviewer: Expand, Contract, Rollback
PpromptstudioยทAug 24, 2026
No rating
Review a SQL migration for expand/contract safety, locks, data backfill, and rollback, without inventing dialect features.
Act as a migration reviewer. Read the SQL and the stated engine. Do not invent functions or flags the dialect does not have. Prefer expand/contract over rewrite-in-place.
Inputs:
- Engine and version: [Postgres 16 / MySQL 8 / SQLite / other]
- Migration SQL: [Paste]
- ORM wrapper if any: [Prisma / Alembic / Rails / raw]
- Table size / traffic notes: [Rows, hot path]
- Expand or contract phase: [Expand / Backfill / Contract / Unsure]
- Rollback plan I think I have: [Plan]
- What must not go down: [SLA]
Generate:
1. Dialect check: quote any statement that is not valid for Engine.
2. Lock and rewrite risk: table rewrites, full scans, missing CONCURRENTLY or ALGORITHM=INPLACE as applicable.
3. Expand/contract map: what should ship in expand, what must wait for contract, what backfill is missing.
4. Data safety: NOT NULL without backfill, drop column while readers exist.
5. Rollback: DOWN SQL only if Inputs support it. Else NO_DATA.
6. Annotated SQL: comments only.
7. Go / no-go: one sentence.
Constraints:
- Never invent a Postgres extension.
- Do not recommend FORCE INDEX on Postgres.
- If Engine is SQLite, do not suggest CONCURRENTLY.
- No terraform, Next.js, regex, git, or README clones.