py-migrate
Installation
SKILL.md
Database Migrations (Alembic + SQLAlchemy)
Overview
Safe, reversible PostgreSQL schema changes using Alembic with SQLAlchemy 2.0 async. Models drive migrations via autogenerate.
Core principle: Models are the source of truth. Autogenerate from models, review every migration, test up/down cycle.
When to Use
- Adding or modifying SQLAlchemy models
- Creating new tables, columns, indexes, constraints
- Data migrations (backfills, transforms)
- Enum type changes