Production Database Migration Plan
Produces a migration plan with a backward-compatible intermediate step and an explicit rollback, instead of a single-step schema change that breaks the running application.
Prompt
Plan a production database migration. Baseline assumption: the old and new application versions will run concurrently during deployment.
Required change: [describe] Current schema: [relevant DDL] Data volume: [row counts in affected tables] Maintenance window: [available / none]
Produce:
- Decomposition into backward-compatible steps — add, dual-write, backfill, switch reads, drop old. Every step must work with both application versions running.
- A script per step — exact runnable DDL and DML. For each, state whether it locks the table and for how long.
- Backfill — batched or single-shot. If batched: batch size, delay between batches, and how to resume after an interruption.
- Rollback plan — for each step, how to revert. Explicitly identify the point of no return and what recovery from it requires.
- Verification — a query proving the step succeeded, and a query detecting rows that did not migrate.
- Deployment order — schema first or code first. Justify.
- What will break — three things that could go wrong and the early signal for each.
If the change drops a column or table: begin with a separate deprecation step and wait a full deployment cycle before the actual drop.
Why this converts well
- Ready to copy and use immediately
- Tailored for legal and public-sector work
- Easy to adapt to internal workflows
Tags
Related Prompts
Tool Specification for a Legal AI Agent
Produces a complete agent tool definition — schema, description, errors, permissions — with emphasis on tools that perform irreversible actions.
Designing a Structured Output Schema for Legal Data
Designs a JSON schema for legal data extraction with explicit representation of uncertainty and missing values instead of silent defaults.
Regression Test Suite for a Production Prompt
Builds a test suite for a prompt before changing it, catching silent regressions introduced by an innocent-looking improvement or a model swap.