py-alembic-patterns

Guide Alembic PostgreSQL migrations with review and rollback practices.

Updated Dec 22, 2025
One-click install
npx skills add https://github.com/CJHarmath/claude-agents-skills --skill py-alembic-patterns
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: py-alembic-patterns
Source: https://github.com/CJHarmath/claude-agents-skills/tree/main/skills/py-alembic-patterns
Command: npx skills add https://github.com/CJHarmath/claude-agents-skills --skill py-alembic-patterns

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Alembic autogenerate is convenient but misses things and sometimes generates dangerous migrations. Schema changes are high-risk - bad migrations cause data loss or downtime. Every migration needs human review.

Core Features & Use Cases

  • Migration Commands
  • Reviewing Autogenerated Migrations
  • Safe Migration Structure
  • Data Migrations
  • Multiple Heads & Testing Migrations
  • Production Safety & Rollback

Quick Start

Use Alembic to generate a migration from model changes and review it before applying.

Frequently Asked Questions about py-alembic-patterns

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

FAQPage Schema
How do I review autogenerated Alembic migrations for PostgreSQL safely?

Review autogenerated Alembic migrations by manually inspecting the generated schema changes and enforcing explicit downgrades to prevent data loss. This ensures dangerous automated migrations are caught before applying them to PostgreSQL.

Why does Alembic autogenerate miss things and create dangerous migrations?

Alembic autogenerate misses schema changes it cannot detect and sometimes creates dangerous migrations that cause data loss. Human review of every migration is required to catch these missed changes and ensure safe PostgreSQL schema updates.

What is the best way to structure safe rollback techniques for SQLAlchemy data migrations?

Structure safe rollbacks by enforcing explicit downgrade functions and testing data migrations with real data volumes. This approach prevents downtime and ensures schema changes can be safely reversed in PostgreSQL.

How do I handle multiple heads when testing Alembic migrations?

Handle multiple heads by resolving branching migration histories before testing. Testing migrations with real data volumes across these common schema changes ensures production safety and verifies that rollback techniques work correctly.

Does this approach to schema change work with careful data migrations in production?

Yes, this approach works by enforcing careful data migrations and testing with real data volumes. It provides production safety guidance and rollback techniques specifically designed to prevent downtime during PostgreSQL schema changes.