AI Prompts Library

Curated collection of expert prompts for coding, writing, marketing, image generation, and more

Have a great prompt? Submit it to the library →

Coding

Migration Generator (Database Schema)

Optimized for: claude-opus-4-7 • TEXT
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.

Schema changes, production database operations

Coding

Database Migration Script Generator

Optimized for: gpt-4o • TEXT
Generate database migration script for [DATABASE: PostgreSQL/MySQL/MongoDB].

**Migration Type:**
- [ ] Create table
- [ ] Alter table
- [ ] Add column
- [ ] Drop column
- [ ] Add index
- [ ] Data migration

**Details:**
[DESCRIBE SCHEMA CHANGES]

**Generate:**

1. **Up Migration** (apply changes)
2. **Down Migration** (rollback)
3. **Data Migration** (if needed)
4. **Validation Queries**

**Requirements:**
- Idempotent (can run multiple times safely)
- Transaction-wrapped
- Rollback-safe
- Include comments
- Handle edge cases
- Test data examples
- Performance considerations for large tables

**Also provide:**
- Pre-migration checklist
- Post-migration validation
- Backup recommendations

Database migrations, schema changes, data migrations

Want Custom Prompts?

Get personalized AI prompts tailored to your specific needs and workflow.

Contact Us