database-migrations

Community

Manage database schema changes with confidence.

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.py and creating migrations with alembic 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 pytest tests to verify migrations can upgrade and downgrade, and preserve data integrity.
  • Use Case: A backend team needs to add a new phone column to the users table and migrate existing status values. 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.
View Source Repository