Migration Guide Prompt (ChatGPT)
Migrations fail when the rollback plan is an afterthought. This prompt designs rollback capability as a first-class requirement, alongside the zero-downtime strategy. The pre-migration checklist prevents migrations that fail immediately due to missing prerequisites, which is the most common cause of emergency rollbacks. This variant is formatted for ChatGPT: Optimised for GPT-4o and GPT-4 Turbo. Uses markdown formatting and system/user message separation.
## System
You are an expert AI assistant. Respond using clear markdown formatting.
## User
You are a senior software architect specialising in system migrations and upgrades.
Create a detailed migration plan for the following change:
Migration type: {{migration_type}}
From: {{from_state}}
To: {{to_state}}
System constraints: {{constraints}}
Rollback requirement: {{rollback_requirement}}
Produce a migration plan covering:
1. **Pre-migration checklist** — what must be true before migration begins
2. **Migration steps** — numbered, ordered steps with estimated duration for each
3. **Data migration strategy** — how existing data is transformed (if applicable)
4. **Zero-downtime strategy** — how to migrate without service interruption
5. **Validation steps** — how to verify the migration succeeded
6. **Rollback plan** — exact steps to reverse the migration if it fails
7. **Risk assessment** — top 3 risks and mitigations
Include any SQL scripts, code changes, or configuration diffs needed for each step.Variables
{{migration_type}}Type of migration: database schema, API version, framework upgrade, cloud provider, etc.{{from_state}}Current state, e.g., "PostgreSQL schema v1", "REST API v1", "React 17"{{to_state}}Target state, e.g., "PostgreSQL schema v2 with new columns", "REST API v2", "React 19"{{constraints}}System constraints, e.g., "cannot afford downtime", "must support both versions for 30 days"{{rollback_requirement}}Rollback SLA, e.g., "must be able to roll back within 5 minutes", "no rollback required"Example
migration_type: database schema from_state: users table without email_verified column to_state: users table with email_verified boolean column (default false) constraints: production system with 1M users, cannot afford downtime rollback_requirement: must be able to roll back within 5 minutes
**Migration Steps:** 1. Add column as nullable (no lock needed): ALTER TABLE users ADD COLUMN email_verified BOOLEAN DEFAULT FALSE; 2. Backfill existing rows in batches of 1000 to avoid lock contention 3. Add NOT NULL constraint after backfill completes 4. Deploy application code that reads/writes the new column 5. Monitor error rates for 30 minutes **Rollback Plan:** DROP COLUMN email_verified; — safe because column was added, not renamed Estimated rollback time: 30 seconds for the schema change
Related Tools
FAQ
- How do I handle large table migrations without downtime?
- Use the expand/contract pattern: first add the new structure alongside the old, backfill data, update the application to write to both, then remove the old structure. This allows instant rollback at any stage.
- Can this generate Liquibase or Flyway migration scripts?
- Yes. Add "Format migration scripts as Flyway V{version}__description.sql files" to the constraints field. The AI will format the SQL scripts with the correct filename conventions.
- How do I migrate a REST API without breaking existing clients?
- Use versioning (v1, v2 path prefixes) and maintain both versions in parallel during the transition period. The migration plan will include deprecation notices, client communication timelines, and sunset dates.
Related Prompts
Migrations fail when the rollback plan is an afterthought. This prompt designs rollback ca...
Migration Guide Prompt (Claude)Migrations fail when the rollback plan is an afterthought. This prompt designs rollback ca...
Migration Guide Prompt (Gemini)Migrations fail when the rollback plan is an afterthought. This prompt designs rollback ca...
Migration Guide Prompt (LLaMA / Ollama)Migrations fail when the rollback plan is an afterthought. This prompt designs rollback ca...
REST API Design PromptGood API design is about consistency and predictability. This prompt enforces REST convent...
Database Schema Design PromptDatabase schema mistakes are the most expensive to fix after launch because they require d...