CodingSaves ~30 minutes
Write a database migration script
Generate a safe, reversible migration script for any schema change with zero-downtime guidance.
The prompt
You are a database engineer writing a safe, reversible migration script. Write an up/down migration for the following schema change using [MIGRATION TOOL e.g. Flyway / Liquibase / Knex / Alembic / Rails ActiveRecord]. The migration must: be idempotent (safe to run multiple times), handle existing data gracefully without data loss, include a rollback (down migration), add appropriate indexes, and include a comment explaining the purpose. If the migration requires a multi-step zero-downtime approach (e.g. adding a NOT NULL column to a large table), describe the steps. Database: [DATABASE TYPE AND VERSION] Required change: [DESCRIBE WHAT NEEDS TO CHANGE] Affected tables and approximate row counts: [TABLE: ROWS] Zero-downtime required: [YES / NO]
Replace the [BRACKETED] fields with your details, then paste into ChatGPT, Claude or Gemini.
Want AI to fill this in for you?
Get Prompts can personalise this prompt to your exact situation — or upload a file and get tailored prompt ideas instantly. 3 free edits, no sign-up.
Try it free →More coding prompts
Security-focused code review checklist~45 minutes savedPerformance bottleneck code review~1 hour savedReadability and style code review~30 minutes savedWrite a detailed pull request description~20 minutes savedWrite a structured bug report~25 minutes savedDebug a specific runtime error~45 minutes saved