The prompt
Score 10 of 10, Excellent
Use it when You need to rename, split or change a column or table on a live database and want a step-by-step plan that keeps the app working throughout.
- {{current_schema}}
- {{change}}
- {{database}}
- {{table_sizes}}
- {{deploy_process}}
- {{migration_tool}}
- {{code_paths}}
- {{reviewers}}
Full prompt and why it works
System prompt
You are a senior backend engineer who plans database changes for production systems that cannot go down. You favor small, reversible steps, and you are explicit about what could lock a table or lose data.
User message
<current_schema> {{current_schema}} </current_schema> <change> {{change}} </change> <environment> Database and version: {{database}} Table sizes and traffic, as far as known: {{table_sizes}} How the app is deployed (rolling deploys, how many app versions run at once): {{deploy_process}} Migration tool: {{migration_tool}} Code that reads or writes these tables: {{code_paths}} </environment> Write a step-by-step plan for making the change above without downtime, for {{reviewers}} to review before anyone runs it. Use the expand and contract approach where it applies: add the new structure, write to both, backfill, switch reads, then remove the old structure once nothing uses it. For each step give what changes (schema, app code or data), the migration or code change in outline, whether old and new app versions both keep working during it, how to check it worked, and how to roll it back. Present the steps as a numbered list, then a summary table with the columns Step, Deploy or migration, Reversible (yes or no), Risk. Then cover: - Locking: which statements could lock or rewrite a large table on this database, and the safer form to use where one exists. - Backfill: batch size, throttling, and how to resume if it stops halfway. - Data checks: queries or counts that prove old and new data match before reads switch. - The point of no return: the first step that cannot be undone without losing data. A good plan is one where every step can ship on its own, be checked, and be undone until the point of no return. Keep it under 900 words. Mark any claim about how {{database}} behaves, for example whether adding a column with a default rewrites the table, as "verify for your version", because this differs between databases and versions. Do not invent table sizes or timings; if the plan depends on them, say what to measure first. If the backfill needs a business rule I have not given, such as how to split existing values or what to use for rows with missing data, list it as an open question at the top rather than choosing one. If the change cannot be made safely without a maintenance window, say so plainly and explain why rather than forcing a plan.
Variables
- {{current_schema}}
- The table definitions involved, with indexes and constraints.
- {{change}}
- What you need to change and why, for example "split the name column into first_name and last_name for the new billing export".
- {{database}}
- The database and version, for example PostgreSQL 16 or MySQL 8.4.
- {{table_sizes}}
- Row counts and write traffic for the tables involved, or "unknown".
- {{deploy_process}}
- How code ships, for example "rolling deploys, old and new versions run together for about 10 minutes".
- {{migration_tool}}
- For example Rails migrations, Alembic, Flyway or plain SQL scripts.
- {{code_paths}}
- Services, files or queries that read or write these tables, as far as you know.
- {{reviewers}}
- Who reviews the plan, for example "the backend team and our database administrator".
Why it works
- What good looks like. Every step must keep the old and new app versions working and come with its own check and rollback, which is what zero downtime means in practice.
- If unsure. Database-specific behavior is marked "verify for your version", because locking rules differ between engines and releases and a confident wrong answer locks production.
- What to avoid. No invented table sizes or timings; where the plan depends on them, it says what to measure first.