db-migrate

Automate version-controlled database schema migrations with Alembic upgrade and downgrade workflows.

4|Updated Dec 5, 2025
One-click install
npx skills add https://github.com/aaaa47080/stock_agent --skill db-migrate-aaaa47080
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: db-migrate
Source: https://github.com/aaaa47080/stock_agent/tree/main/.opencode/skills/db-migrate
Command: npx skills add https://github.com/aaaa47080/stock_agent --skill db-migrate-aaaa47080

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Database migrations are risky without version control, testing, and rollback procedures. This Skill automates safe schema evolution through Alembic, enabling reproducible upgrades and controlled downgrades with environment safeguards.

Core Features & Use Cases

  • Version-controlled migrations with upgrade/downgrade workflows
  • Safety-first production rules, backups, and safe-apply checks
  • Clear mapping to core/orm models and database schemas for consistent evolution

Quick Start

Run the Alembic upgrade head on the target database to apply pending migrations.

Frequently Asked Questions about db-migrate

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

FAQPage Schema
How do I automate database schema migration using Alembic?

Automate database schema migration by applying version-controlled Alembic workflows to manage upgrades, downgrades, and history tracking across environments. You run the Alembic upgrade head command on the target database to apply pending migrations safely.

What is the safest way to apply SQL schema changes in production?

The safest way to apply SQL schema changes in production is using a safety-first workflow with structured rules, environment-specific connection handling, and backup considerations. This ensures reproducible upgrades and controlled downgrades.

How do I rollback a database migration if a deployment fails?

Rollback a database migration using the structured downgrade workflows provided by Alembic version control. This process reverts the schema evolution safely by applying the defined downgrade scripts for the specific migration revision.

Can I use this for managing schema version control across multiple environments?

Yes, you can manage schema version control across multiple environments using environment-specific connection handling. The workflow ensures reproducible schema evolution by applying targeted safety rules and safe-apply checks per environment.

Do I need to map ORM models before running database migrations?

You should map ORM models to database schemas before running migrations to ensure consistent evolution. Clear mapping to core and ORM models allows the version-controlled migration scripts to accurately reflect structural changes.

Why does my database migration workflow need structured backup checks?

Database migration workflows need structured backup checks to prevent data loss during risky schema evolution. Implementing safety-first production rules and backup considerations ensures that reproducible upgrades can be safely reversed if errors occur.