db-migration

Manage SQLAlchemy database migrations with Alembic workflows.

Updated Aug 27, 2026
One-click install
npx skills add https://github.com/liushuang393/serverlessAIAgents --skill db-migration-liushuang393
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: db-migration
Source: https://github.com/liushuang393/serverlessAIAgents/tree/main/agentflow/skills/builtin/db-migration
Command: npx skills add https://github.com/liushuang393/serverlessAIAgents --skill db-migration-liushuang393

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill provides standardized management of database migrations for SQLAlchemy projects using Alembic, enabling clean schema changes, history tracking, and safe rollbacks.

Core Features & Use Cases

  • Initialize and configure Alembic within a Python project to manage migrations.
  • Auto-generate migration scripts from SQLAlchemy model changes for rapid iteration.
  • Apply migrations to bring the database up to the latest revision across development, staging, and production environments.
  • Downgrade or rollback to previous revisions to recover from schema errors or misconfigurations.
  • Review migration history and current schema state to maintain traceability and compliance.

Quick Start

  • Initialize Alembic in your project: cd path/to/your_app alembic init migrations
  • Auto-generate a migration after model changes: alembic revision --autogenerate -m "add_users_table"
  • Apply migrations to the latest revision: alembic upgrade head
  • Downgrade to the previous revision: alembic downgrade -1

Frequently Asked Questions about db-migration

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

FAQPage Schema
How do I auto-generate database migrations from SQLAlchemy model changes?

Auto-generating database migrations from SQLAlchemy model changes uses Alembic's autogenerate feature to compare models and create scripts. Run alembic revision --autogenerate -m "description" to produce a new migration file for schema updates.

What is the best way to manage database versioning across development and production?

Database versioning across development, staging, and production is managed by applying Alembic migrations to track schema history. Running alembic upgrade head brings environments to the latest revision, ensuring consistent database schemas throughout deployment.

How do I rollback a database schema change in SQLAlchemy?

Rolling back a database schema change in SQLAlchemy uses Alembic's downgrade workflow. Execute alembic downgrade -1 to revert to the previous revision, safely recovering from schema errors or misconfigurations without manual SQL intervention.

Does Alembic work with existing Python applications using SQLAlchemy?

Alembic works with existing Python applications using SQLAlchemy by initializing a migrations directory and configuring alembic.ini and env.py. It requires SQLAlchemy and database drivers to manage schema changes, version history, and rollback workflows.

How do I initialize Alembic in a Python project?

Initializing Alembic in a Python project involves running alembic init migrations in your application directory. This creates the necessary directory structure and configuration files to begin managing database versioning and generating migration scripts.