Plan Zero-Downtime Database Migration and Backfill
Get a step-by-step technical plan for migrating database schemas without downtime, including data backfill logic and verification steps.
Agent prompt for ChatGPT and Claude
Prompt
mkdir -p .agents/skills/plan-zero-downtime-database-migration-and-backfill && curl -sL "https://prompts-gpt.com/prompts/plan-zero-downtime-database-migration-and-backfill/raw" -o .agents/skills/plan-zero-downtime-database-migration-and-backfill/SKILL.md---
name: plan-zero-downtime-database-migration-and-backfill
description: "Get a step-by-step technical plan for migrating database schemas without downtime, including data backfill logic and verification steps."
---
# Plan Zero-Downtime Database Migration and Backfill
Get a step-by-step technical plan for migrating database schemas without downtime, including data backfill logic and verification steps.
## Prompt
```
Act as a Senior Database Reliability Engineer. I need to perform a breaking schema migration on a production SQL database. Before providing the plan, please ask me these 3 questions: 1. What is the current schema change you need to implement? 2. What is the approximate size of the table in rows? 3. Is the database using Postgres, MySQL, or another engine? Once I answer, provide a migration strategy divided into 5 phases: Dual-Write, Backfill, Read-Switch, Cleanup, and Verification. Rules: 1. Every phase must include a specific SQL verification query. 2. Ensure all steps are backward-compatible. 3. Use standard SQL syntax. 4. Do not include placeholders. Output format: ## Phase Name - Goal: One sentence. - Action: Bulleted technical steps. - Verification: The exact SQL query to confirm success. This is not legal or financial advice; consult with a database architect for high-stakes production changes.
```
## Usage Notes
Use this prompt when you need to safely alter production database tables without service interruption. It works well in ChatGPT, Claude, or GitHub Copilot Chat for planning migrations. You must have your current schema and table size ready to answer the initial questions.
Act as a Senior Database Reliability Engineer. I need to perform a breaking schema migration on a production SQL database. Before providing the plan, please ask me these 3 questions: 1. What is the current schema change you need to implement? 2. What is the approximate size of the table in rows? 3. Is the database using Postgres, MySQL, or another engine? Once I answer, provide a migration strategy divided into 5 phases: Dual-Write, Backfill, Read-Switch, Cleanup, and Verification. Rules: 1. Every phase must include a specific SQL verification query. 2. Ensure all steps are backward-compatible. 3. Use standard SQL syntax. 4. Do not include placeholders. Output format: ## Phase Name - Goal: One sentence. - Action: Bulleted technical steps. - Verification: The exact SQL query to confirm success. This is not legal or financial advice; consult with a database architect for high-stakes production changes.Example output
Tips and common edits
Why this works
- Forces a structured five-phase approach that prevents common production outages.
- Requires specific SQL verification queries to ensure data integrity at each step.
- Ensures backward compatibility by mandating a dual-write phase before cutting over.
Use this prompt when you need to safely alter production database tables without service interruption. It works well in ChatGPT, Claude, or GitHub Copilot Chat for planning migrations. You must have your current schema and table size ready to answer the initial questions.
Common edits
- Adjust the batch size in the backfill phase based on your database write throughput limits.
- Modify the verification queries to match your specific database engine syntax if it differs from Postgres.
Reuse it: Use in a workflowAdapt in the builder
Prompt details
- By
- Prompts-GPT editors
- Published
Did this prompt work?
More like this
Automated Database Migration Safety Review for Claude Code
You get a structured risk assessment of your SQL migration scripts to prevent production downtime, data loss, and long-running table locks.
Design Cursor-Based Pagination Logic for High-Volume APIs
Get a complete implementation plan for cursor-based pagination including SQL queries, cursor encoding logic, and strategies for handling record deletions.
Find and Fix Data Quality Issues with Ready-to-Run SQL Checks
Paste your schema and get SQL queries that catch duplicates, NULLs, orphaned foreign keys and out-of-range values, each with what a bad result means and a fix.
Debug SQL query errors and incorrect row counts
Find syntax errors, incorrect joins, and silent null filter bugs in database queries. Use it when a query returns syntax errors or unexpected row counts.
Fix N+1 Database Query Patterns in ORM Code
This prompt identifies N+1 query issues in your code, provides the optimized eager-loading syntax, and calculates the reduction in database round-trips.
Spec and Build a Weekly KPI Dashboard in Claude Data
Get a checked weekly KPI dashboard spec with exact definitions, visible queries, week-over-week comparisons, RAG rules and a data checks panel, then the build.
- Differentiate structural null values from missing data
- Create MCP Tool Configuration for Claude Code
- Design a Normalized Database Schema from a Plain Feature Description
- Write SQL Queries from a Plain-English Question and Your Table Schema
- Plain-English Question to a Correct SQL Query for Your Schema
- Design a clean rollback plan for risky launches