alembic

Automate Alembic database migrations with SQLAlchemy across environments.

61|15|Updated Oct 18, 2025
One-click install
npx skills add https://github.com/manutej/luxor-claude-marketplace --skill alembic
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: alembic
Source: https://github.com/manutej/luxor-claude-marketplace/tree/main/plugins/luxor-database-pro/skills/alembic
Command: npx skills add https://github.com/manutej/luxor-claude-marketplace --skill alembic

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires alembic>=1.13.0, sqlalchemy>=2.0.0, psycopg2-binary>=2.9.0, pytest>=7.0.0.

What problem does it solve?

Alembic provides version-controlled database migrations, enabling safe schema changes with upgrade/downgrade paths, reproducibility across environments, and rollbacks for customer-support data schemas.

Core Features & Use Cases

  • Manual & Autogenerate Migrations: Create precise migrations or auto-detect changes.
  • Downgrade & Rollback: Safely revert migrations in production.
  • SQLAlchemy Integration: Seamless work with SQLAlchemy models.
  • Testing Migrations: Validate migrations with pytest fixtures.

Quick Start

Create and apply a new migration to add a column to tickets.

Frequently Asked Questions about alembic

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

FAQPage Schema
How do I safely migrate a PostgreSQL database schema with version control?

Database schema migration with version control uses versioned scripts to track and apply changes reproducibly across environments. Alembic automates this by generating migration files that can be applied, rolled back, or downgraded, ensuring your PostgreSQL schema changes are auditable and reversible.

Can I automatically detect SQLAlchemy model changes and generate migrations?

Yes, Alembic autogenerate compares your SQLAlchemy models against the database schema and creates migration scripts for detected changes. This reduces manual work while still letting you review and edit migrations before applying them to PostgreSQL.

How do I roll back or downgrade a migration in production?

Alembic tracks migration history and provides downgrade paths so you can safely revert schema changes in production. Each migration includes both upgrade and downgrade logic, allowing you to step backward through your schema version history without data loss.

What's the best way to handle zero-downtime database migrations?

Zero-downtime migrations split risky changes—like adding constraints or dropping columns—into smaller steps that don't lock tables. Alembic supports this through manual migrations and careful sequencing, paired with deployment strategies that coordinate application and schema updates.

Does Alembic work with pytest for testing migrations?

Yes, Alembic integrates with pytest through migration fixtures and test scripts. You can validate that migrations run correctly, apply without errors, and handle data integrity before deploying to staging or production PostgreSQL environments.

How do I manage migrations across development, staging, and production?

Alembic uses environment-configured database URLs to apply the same versioned migration scripts across multiple PostgreSQL environments. This ensures schema consistency and reproducibility from development through production while tracking which migrations have run on each database.