migration-patterns

Automate safe, reversible PostgreSQL migrations with rollback plans.

Updated Feb 7, 2026
One-click install
npx skills add https://github.com/jsamuelsen11/claude-config --skill migration-patterns-jsamuelsen11
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: migration-patterns
Source: https://github.com/jsamuelsen11/claude-config/tree/main/plugins/ccfg-postgresql/skills/migration-patterns
Command: npx skills add https://github.com/jsamuelsen11/claude-config --skill migration-patterns-jsamuelsen11

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

PostgreSQL migrations are error-prone and risky without proper patterns; this skill provides production-grade guidance to write safe, reversible schema changes, minimize downtime, and ensure robust rollback paths.

Core Features & Use Cases

  • Safe, reversible migrations: Ensure every change has a down-migration and rollback plan.
  • Zero-downtime patterns: Use non-blocking index operations, expand-contract workflows, and battches for large tables.
  • Guided best-practices: Applies to adding columns, renames, constraint updates, and complex schema refactors.

Quick Start

Begin by adopting the provided safe-migration patterns to structure and apply your PostgreSQL changes with rollback plans.

Frequently Asked Questions about migration-patterns

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

FAQPage Schema
How do I perform zero-downtime PostgreSQL schema migrations in production?

Zero-downtime PostgreSQL migrations require non-blocking concurrent index operations and expand-contract workflows to apply schema changes without locking tables. This approach uses batches for large tables to minimize disruption during production deployments.

What is a down migration and why do I need one for PostgreSQL?

A down migration is the rollback plan for a schema change, ensuring every database modification is reversible. You need down migrations to safely revert PostgreSQL updates if a deployment fails or causes unexpected application errors.

How to add a concurrent index in PostgreSQL without locking the table?

Adding a concurrent index in PostgreSQL requires using non-blocking index operations that allow continued read and write access to the table. This concurrent approach prevents exclusive locks that would otherwise cause application downtime during migration.

What is the best way to refactor a large PostgreSQL table with minimal downtime?

Refactoring large PostgreSQL tables requires an expand-contract workflow combined with batch processing to avoid prolonged locks. This pattern incrementally applies schema changes, ensuring the database remains available throughout the migration process.

When do I need transaction safety considerations for PostgreSQL migrations?

Transaction safety considerations are needed for PostgreSQL migrations when running multiple schema changes that must succeed or fail together. However, concurrent index operations cannot be executed inside a transaction block and require separate handling.

Can I use automated rollback strategies for complex PostgreSQL schema refactors?

Automated rollback strategies for PostgreSQL schema refactors require enforcing down migrations and thorough testing before deployment. This ensures complex changes like constraint updates or column renames have validated, robust rollback paths.