migration-patterns

Plan safe, reversible database migrations for production schema changes.

8|2|Updated Jan 15, 2026
One-click install
npx skills add https://github.com/bradtaylorsf/alphaagent-team --skill migration-patterns-bradtaylorsf
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: migration-patterns
Source: https://github.com/bradtaylorsf/alphaagent-team/tree/main/plugins/aai-dev-database/skills/migration-patterns
Command: npx skills add https://github.com/bradtaylorsf/alphaagent-team --skill migration-patterns-bradtaylorsf

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill provides best practices and patterns for performing safe, reversible, and non-blocking database migrations in production environments, minimizing downtime and risk.

Core Features & Use Cases

  • Safe Schema Changes: Learn how to add, remove, or rename columns and constraints without locking tables.
  • Production-Ready Patterns: Understand strategies for backfilling data, handling NOT NULL constraints, and adding foreign keys safely.
  • Large Table Migrations: Implement batched updates and utilize tools like pt-online-schema-change for minimal impact.
  • Use Case: Safely add a new email column to a large users table in production, backfill existing users, and then apply a NOT NULL constraint without causing an outage.

Quick Start

Use the migration-patterns skill to learn how to safely add a new column to a production database table.

Frequently Asked Questions about migration-patterns

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I safely add a NOT NULL column to a large production database?

To safely add a NOT NULL column to a production database, you should add the column as nullable, backfill existing rows in batches, and then apply the constraint to avoid table locks and outages.

What is the best way to rename a column in SQL without causing downtime?

Renaming a column without downtime requires a multi-step pattern: add the new column, dual-write to both columns, backfill existing data, update application reads, and finally drop the old column.

How do database migration patterns handle large table schema changes?

Database migration patterns handle large table schema changes by using batched updates and tools like pt-online-schema-change to perform operations with minimal impact and avoid locking the production database.

Can I use Prisma for reversible and atomic database migrations in production?

Yes, you can use Prisma to apply safe, reversible, and atomic database migrations in production by following specific patterns for schema changes, constraint management, and data backfilling to minimize downtime risks.

How do you safely add a foreign key constraint to an existing table?

To safely add a foreign key constraint to an existing table, you validate the data first, add the constraint in a separate migration step, and ensure the operation does not lock the table during production traffic.

Why do database migrations cause table locks and data corruption risks?

Database migrations cause table locks and data corruption risks when schema changes like adding constraints or renaming columns are executed directly on large tables during active production traffic without batched or atomic patterns.