database-migration

Create and manage Alembic migrations for SQLAlchemy models.

Updated Nov 2, 2025
One-click install
npx skills add https://github.com/PrasadTelasula/EvokeQOne --skill database-migration-prasadtelasula
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: database-migration
Source: https://github.com/PrasadTelasula/EvokeQOne/tree/main/.claude/skills/database-migration
Command: npx skills add https://github.com/PrasadTelasula/EvokeQOne --skill database-migration-prasadtelasula

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill helps you create, review, and apply Alembic migrations for SQLAlchemy models, ensuring your database schema evolves safely and reversibly.

Core Features & Use Cases

  • Auto-generate migrations from model changes
  • Review upgrade/downgrade paths before applying
  • Apply migrations to the target database
  • Perform data migrations and transformations as needed
  • Best practices for rollback and versioning

Quick Start

cd backend

Auto-generate a migration from model changes

uv run alembic revision --autogenerate -m "descriptive message"

Apply migrations to head

uv run alembic upgrade head

Frequently Asked Questions about database-migration

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

FAQPage Schema
How do I create database migrations for SQLAlchemy model changes?

Create database migrations by running `uv run alembic revision --autogenerate -m "descriptive message"` after modifying your SQLAlchemy models. Alembic auto-generates migration files that define schema changes, which you can review before applying them to your database.

Can I review migrations before applying them to my database?

Yes. Review the generated migration files to verify upgrade and downgrade paths before application. This lets you catch issues, add data transformations, or create indexes and constraints manually before running `uv run alembic upgrade head` to apply migrations to your target database.

What's the best way to handle rollbacks with Alembic migrations?

Alembic migrations are reversible by design. Each migration includes both upgrade and downgrade functions, allowing you to roll back schema changes safely. Test downgrade paths to ensure you can revert changes if needed across your QA and production environments.

Do I need to write migrations manually or can they be auto-generated?

Alembic can auto-generate migrations from SQLAlchemy model changes, but you can also create empty migrations for custom logic like data transformations, index creation, or constraint additions that auto-generation doesn't capture.

How do I apply data migrations and transformations with Alembic?

Create migrations that include custom Python code in the upgrade and downgrade functions to transform, migrate, or validate data alongside schema changes. This lets you handle complex operations like renaming columns, recalculating values, or populating new fields safely.

What are best practices for writing migration messages and version control?

Write descriptive migration messages that clearly explain what schema or data changes occur. Keep migrations small, focused, and reversible. Version control migration files to track all schema evolution, enabling safe collaboration and deployment across QA and production backends.