Back to Skills

Database Migration Planner

Plan and generate safe database migrations with rollback strategies and zero-downtime deployment considerations

databasemigrationssqlschemadeployment

Skill Content

# Database Migration Planner

Plan and generate safe database migrations with built-in safety checks.

## Overview

This skill helps you:

- **Plan Migrations** - Analyze schema changes and generate migration files
- **Safety Analysis** - Identify potentially dangerous operations (column drops, type changes)
- **Rollback Strategy** - Generate matching rollback migrations
- **Zero-Downtime** - Suggest multi-step migration strategies for production

## Safety Checks

Before generating migrations, the skill checks for:

- Destructive column/table drops
- Lock-heavy operations on large tables
- Missing indexes on foreign keys
- Data type changes that could lose data
- Default value additions on large tables

## Supported ORMs

- Prisma (schema.prisma)
- Drizzle ORM
- Knex.js
- TypeORM
- Django migrations
- Rails ActiveRecord
- Alembic (SQLAlchemy)

## Usage

Invoke with: "Plan a migration to add user preferences"

Options:
- "Generate a migration to add an email column to users"
- "Plan a safe migration to rename the orders table"
- "Create a rollback migration for the latest change"

How to use

  1. Copy the skill content above
  2. Create a .claude/skills/migrate-db directory in your project (or ~/.claude/skills/migrate-db to use it in every project)
  3. Save the content as .claude/skills/migrate-db/SKILL.md
  4. Claude Code loads it automatically when the task matches, or run /migrate-db to invoke it directly