Coding TEXT

Migration Generator (Database Schema)

May 1, 2026 Optimized for: claude-opus-4-7 Schema changes, production database operations

Prompt

Generate a database migration for [DATABASE - Postgres / MySQL / SQLite].

Goal: [DESCRIBE - add column, rename table, add index, etc.].
Framework: [Prisma / Knex / Rails / Alembic / raw SQL].

Requirements:
1. The migration must be safe to run on a table with millions of rows in production. No table-level locks if avoidable.
2. Include both UP and DOWN migrations.
3. Defaults handled correctly - if adding a NOT NULL column, propose a backfill strategy.
4. Add appropriate indexes.
5. Name the migration descriptively with a timestamp prefix.

Return the migration file content and a one-paragraph runbook explaining how to apply it safely in production.

Tags

Production-safe schema migrations from a one-line goal.

Share This Prompt

Related Prompts

Have a Great Prompt to Share?

Submit your own AI prompts to the community. The best ones get featured on TokenCalculator - and credited to you.

Submit a Prompt

Ratings & Feedback

0.0 / 5 · 0 votes

Comments