database-migrations
CommunityManage database schema changes with confidence.
Software Engineering#testing#database migrations#Alembic#SQLAlchemy#schema change#upgrade#data migration#downgrade
Authorricardoroche
Version1.0.0
Installs0
System Documentation
What problem does it solve?
This Skill provides best practices for managing database schema changes using Alembic, addressing issues like irreversible migrations, data loss during rollbacks, and inconsistent schema evolution. It ensures safe, reproducible, and testable database updates, minimizing downtime and data integrity risks.
Core Features & Use Cases
- Alembic Setup & Usage: Guides on configuring
alembic/env.pyand creating migrations withalembic revision --autogenerate. - Safe Schema Changes: Provides patterns for safely adding columns (nullable first), modifying column types, and handling foreign key changes.
- Data Migrations: Explains how to perform data transformations within migrations, including multi-phase approaches for complex data changes.
- Migration Testing: Offers patterns for writing
pytesttests to verify migrations can upgrade and downgrade, and preserve data integrity. - Use Case: A backend team needs to add a new
phonecolumn to theuserstable and migrate existingstatusvalues. This skill guides them to add the column as nullable first, then update existing data, and finally make it non-nullable, ensuring no data loss and a smooth deployment.
Quick Start
Create a new Alembic migration to add a phone column to the users table, ensuring it's added as nullable first.
Dependency Matrix
Required Modules
alembicsqlalchemypytest
Components
Standard package💻 Claude Code Installation
Recommended: Let Claude install automatically. Simply copy and paste the text below to Claude Code.
Please help me install this Skill: Name: database-migrations Download link: https://github.com/ricardoroche/ricardos-claude-code/archive/main.zip#database-migrations Please download this .zip file, extract it, and install it in the .claude/skills/ directory.