migration-database

Generate Alembic migrations from SQLModel model changes with import fixes.

Updated Aug 23, 2026
One-click install
npx skills add https://github.com/djimontyp/task-tracker --skill migration-database
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: migration-database
Source: https://github.com/djimontyp/task-tracker/tree/main/.claude/skills/migration-database
Command: npx skills add https://github.com/djimontyp/task-tracker --skill migration-database

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires sqlmodel, alembic, sqlalchemy, psycopg2-binary, and includes references (resource) components.

What problem does it solve?

This Skill automates database migration workflows for SQLModel-based projects using Alembic, ensuring that your database schema always reflects your SQLModel definitions and preventing manual errors or inconsistencies.

Core Features & Use Cases

  • Automatic Migration Generation: Generates migrations automatically from SQLModel changes, enforcing SQLModel as the single source of truth.
  • Mandatory Import Fix: Automatically adds import sqlmodel to generated migrations, preventing common runtime errors.
  • Safety Checks & User Review: Performs pre-generation checks, summarizes changes, and requires explicit user confirmation before applying any migration.
  • Use Case: You've added a new priority field to your Task model. Use this skill to automatically generate the correct Alembic migration, ensure it's valid, and apply it to your database, all while keeping you informed and in control.

Quick Start

To generate a migration for model changes:

just alembic-auto -m "add priority field to Task model"

After reviewing the generated migration file, to apply it:

just alembic-up

Frequently Asked Questions about migration-database

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

FAQPage Schema
How do I automatically generate database migrations for SQLModel model changes?

Automatic migration generation captures schema changes from your SQLModel models using Alembic. Run `just alembic-auto -m "description"` to generate a migration file that reflects your model additions or modifications, then review and apply it with `just alembic-up`.

Does Alembic work with SQLModel and PostgreSQL?

Yes, Alembic integrates with SQLModel and PostgreSQL through SQLAlchemy. This Skill automates the workflow by generating migrations from SQLModel definitions and ensuring PostgreSQL schema changes are applied correctly.

Why do I need to import sqlmodel in my migrations?

SQLModel imports in migration files prevent runtime errors when Alembic applies schema changes. This Skill automatically adds the required `import sqlmodel` statement to generated migrations, eliminating a common failure point.

What's the best way to add a new field to a SQLModel table without manual SQL?

Define the new field in your SQLModel model, then use this Skill to auto-generate the migration with `just alembic-auto`. The Skill creates the correct Alembic migration and handles schema synchronization, keeping your database in sync with your code.

Can I review migrations before applying them to my database?

Yes, this Skill enforces a review-before-apply workflow. After generation, examine the migration file to verify schema changes, then explicitly apply it with `just alembic-up` only when satisfied.

What happens if I modify foreign keys or create new SQLModel models?

This Skill detects schema changes including new models and foreign key relationships. Generate migrations with `just alembic-auto`, review the changes, and apply them to propagate all relationship and constraint updates to your PostgreSQL database.