database-migrations

Plan reversible database schema and data migrations for PostgreSQL and MySQL.

Updated Feb 5, 2026
One-click install
npx skills add https://github.com/gugug168/claudecode-tutorial --skill database-migrations-gugug168
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: database-migrations
Source: https://github.com/gugug168/claudecode-tutorial/tree/main/everything-claude-code-learning/02-Skills/database-migrations
Command: npx skills add https://github.com/gugug168/claudecode-tutorial --skill database-migrations-gugug168

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Provides clear, production-ready patterns and operational guidance to perform schema and data changes without causing downtime, unexpected locking, or irreversible mistakes in live databases.

Core Features & Use Cases

  • Production-safe schema changes: guidance for adding/removing columns, indexes, and renames using expand-and-contract patterns.
  • Data migration best practices: strategies for batching/backfilling large tables, separating DDL and DML, and testing on production-sized datasets.
  • Tool-specific workflows: actionable workflows for PostgreSQL, MySQL, Prisma, Drizzle, Django, TypeORM, and golang-migrate.
  • Use Case: Add a nullable avatar_url column to a users table, backfill values in batches, create indexes concurrently, and then safely remove the old column with no downtime.

Quick Start

Use this skill to plan and execute a zero-downtime migration that adds a new nullable column, backfills data in batches, applies concurrent indexes, and then retires the old column.

Frequently Asked Questions about database-migrations

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

FAQPage Schema
What is the best way to perform zero-downtime database migrations in PostgreSQL?

Zero-downtime database migrations in PostgreSQL require the expand-and-contract pattern: adding new schema elements, backfilling data in batches, and retiring old structures separately to avoid locks. This approach ensures production safety by separating DDL and DML operations.

How do I backfill large tables during a data migration without causing downtime?

Backfilling large tables during data migration requires batching updates into smaller chunks and separating DDL and DML commands. This strategy minimizes table locking and transaction log bloat, allowing production-scale data migrations to execute safely without blocking concurrent application traffic.

Does Prisma support concurrent index creation and expand-and-contract migrations?

Prisma supports concurrent index creation and expand-and-contract migrations by providing actionable workflows for schema changes. It enables production-safe migrations by guiding you to add nullable columns, apply concurrent indexes, and batch backfill data before safely removing old database structures.

Can I use Django or TypeORM for reversible schema changes in production?

Django and TypeORM both support reversible schema changes in production through tool-specific migration workflows. These ORMs enable forward-rollbacks and safe deployments by applying expand-and-contract patterns and concurrent index creation to ensure database schema changes do not cause unexpected locking.

Why do I need to separate DDL and DML commands during a database migration?

Separating DDL and DML commands during a database migration is required to prevent long-running table locks and transactional conflicts. This separation ensures that schema modifications and bulk data updates execute independently, maintaining application availability and ensuring forward-rollback safety.

How do I safely remove an old column with no downtime after a data backfill?

To safely remove an old column with no downtime after a data backfill, you apply the contract phase of the expand-and-contract pattern. This involves verifying the new column is fully populated and application traffic has shifted, allowing the old structure to be retired safely.