PlaybookPrompts

Plan a safe zero-downtime database migration step by step

Coding & Development databasemigrationsreliability

Schema changes on live production databases are high-risk. This prompt produces an ordered migration plan that keeps the app running throughout, including rollback checkpoints at each phase.

Prompt
You are a database reliability engineer. Help me plan a zero-downtime migration for a production database.

Database engine and version: {{DB_ENGINE_VERSION}}
Current schema (relevant tables only):
```
{{CURRENT_SCHEMA}}
```
Desired end state (describe the change in plain English):
{{DESIRED_CHANGE}}
Application deployment model: {{DEPLOYMENT_MODEL}}
(e.g., 'rolling Kubernetes pods', 'blue-green', 'single server with maintenance window')

Produce the following:
1. Expand-contract analysis: identify which steps must happen before the app code changes (expand) and which happen after (contract).
2. Write each migration step as a discrete, reversible SQL statement or migration file. Number them.
3. For each step, specify: (a) whether old and new app code can run simultaneously during this step, (b) estimated lock duration or table unavailability, (c) the exact rollback statement.
4. Flag any step where data loss is possible, even temporarily.
5. Recommend validation queries to run after each step to confirm correctness before proceeding.
6. Note if this migration pattern does not apply to the given deployment model, and suggest an alternative.
Variables to fill in
  • {{DB_ENGINE_VERSION}}
  • {{CURRENT_SCHEMA}}
  • {{DESIRED_CHANGE}}
  • {{DEPLOYMENT_MODEL}}

How to use this prompt

  1. Copy the prompt above (Copy button on the top-right).
  2. Replace each {{VAR}} with your own value. Variables: {{DB_ENGINE_VERSION}}{{CURRENT_SCHEMA}}{{DESIRED_CHANGE}}{{DEPLOYMENT_MODEL}}.
  3. Paste it into one of the recommended tools below.
  4. Iterate: tighten constraints in the prompt if the output is generic.

Why this prompt is structured this way

The prompt is split into explicit steps because LLMs do better when the path is named, not implied. Each variable forces specificity at the input layer — vague inputs get vague outputs.

Heads up: some of the links on this page are affiliate links — meaning we may earn a commission if you sign up after clicking, at no extra cost to you. We only recommend tools we'd put on our own stack. You can see our full affiliate disclosure here.

Pair this prompt with a tool

The PlaybookPrompts weekly

One short email per week. The five sharpest prompts we found, one tool worth your attention, one anti-pattern to avoid. Unsubscribe in one click.

Newsletter signup is not configured. Set PUBLIC_NEWSLETTER_USERNAME in the build env.