database-migrations

Plan zero-downtime PostgreSQL and MySQL schema migrations with batched backfills.

Updated May 9, 2026
One-click install
npx skills add https://github.com/kk20300113-png/my-claude-skills --skill database-migrations-kk20300113-png
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: database-migrations
Source: https://github.com/kk20300113-png/my-claude-skills/tree/main/database-migrations
Command: npx skills add https://github.com/kk20300113-png/my-claude-skills --skill database-migrations-kk20300113-png

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Unplanned database schema changes and unvetted migration scripts are a top cause of production outages, data loss, and extended downtime for engineering teams. This skill removes the risk of ad-hoc manual database modifications by providing proven, production-grade migration patterns and safety guardrails.

Core Features & Use Cases

  • Cross-platform support: Covers best practices for PostgreSQL and MySQL, plus migration workflows for Prisma, Drizzle, Kysely, Django, TypeORM, and golang-migrate ORMs and tooling.
  • Zero-downtime schema changes: Implements the expand-contract pattern for safe column renames, additions, and removals without service interruption.
  • Safe data migration workflows: Provides batched backfill templates and pre-migration checklists to avoid table locks and performance degradation on large datasets.
  • Real-world use case: A SaaS team needs to add a required account_tier column to a 12M row customers table; this skill guides them through adding a nullable column first, backfilling in small batches, then adding the NOT NULL constraint without locking the table or causing downtime.

Quick Start

Use the database-migrations skill to design a zero-downtime migration plan to add a non-null phone_number column to your existing users table, including batched backfill and concurrent index creation steps.

Frequently Asked Questions about database-migrations

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

FAQPage Schema
How do I add a non-null column to a large PostgreSQL table without locking it?

To add a non-null column to a large PostgreSQL table without locking, use the expand-contract pattern: add the column as nullable, batch backfill the data in small updates, then enforce the NOT NULL constraint. This sequence prevents table locks and service interruption.

How does zero downtime database migration work?

Zero downtime database migration works by separating DDL and DML operations, using concurrent index creation, and applying expand-contract patterns for schema changes. This allows schema updates to proceed without blocking queries or causing service interruptions.

Can I use Prisma or Drizzle for safe data backfills on large datasets?

Yes, you can use Prisma, Drizzle, Kysely, TypeORM, Django, or golang-migrate for safe data backfills. The workflow provides batched backfill templates and pre-migration checklists to avoid table locks and performance degradation on large datasets.

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

The best way to rename a column in MySQL without downtime is the expand-contract pattern. You add the new column, backfill it in batches, update application queries to use it, and eventually remove the old column, ensuring no service interruption occurs.

When do I need to separate DDL and DML operations in database migrations?

You need to separate DDL and DML operations in database migrations when modifying large production tables. Separating schema changes from data updates prevents long-held locks, avoids performance degradation, and satisfies forward-only migration immutability requirements.

Why do unvetted database schema changes cause production outages?

Unvetted database schema changes cause production outages because ad-hoc modifications often lack concurrent index creation and batched updates, leading to unexpected table locks, data corruption, and extended downtime for engineering teams.