db-migration-enforcer

Detect schema drift between SQLAlchemy models and database tables.

1|Updated Jan 25, 2026
One-click install
npx skills add https://github.com/kellyson520/TG-ONE --skill db-migration-enforcer
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: db-migration-enforcer
Source: https://github.com/kellyson520/TG-ONE/tree/main/.agent/skills/db-migration-enforcer
Command: npx skills add https://github.com/kellyson520/TG-ONE --skill db-migration-enforcer

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires sqlalchemy, and includes scripts (resource) components.

What problem does it solve?

Automates the synchronization of SQLAlchemy models with the live database by detecting schema drift and generating safe, maintainable migrations.

Core Features & Use Cases

  • Automated drift detection between models.py and database tables.
  • Centralized migration logic via migrate_db that records changes and applies them safely.
  • Use Case: On model evolution, run the enforcer to reconcile differences without manual SQL crafting.

Quick Start

Run the enforcer to identify missing columns and update the migrate_db function accordingly.

Frequently Asked Questions about db-migration-enforcer

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

FAQPage Schema
How do I detect schema drift between SQLAlchemy models and my live database?

To detect schema drift, compare SQLAlchemy model definitions against live database tables to identify missing columns or mismatches, then generate safe migration patches to reconcile the differences automatically.

Why does my application throw startup errors about missing columns after modifying SQLAlchemy models?

Startup errors about missing columns occur due to schema drift when SQLAlchemy models are modified without applying corresponding database migrations. Run an automated drift detection check to identify and patch the missing schema elements.

What is the best way to automate SQLAlchemy database migrations safely?

Automating SQLAlchemy migrations safely requires enforcing Check-Before-DDL logic, centralizing migration commands within a migrate_db function, recording applied changes, and logging outcomes to maintain schema synchronization.

Do I need to manually write SQL to update migrate_db logic when models change?

No, you do not need to manually write SQL. Automated migration enforcers can generate safe migration patches and update the migrate_db logic automatically by checking model definitions against the live database schema.

How do I centralize database migration logic to prevent schema drift in SQLAlchemy?

Centralize database migration logic by routing all schema changes through a single migrate_db function that enforces Check-Before-DDL, records applied changes, and logs outcomes to prevent untracked schema drift.

Can I use automated migration checks when startup errors indicate missing database columns?

Yes, automated migration checks are designed specifically for startup errors indicating missing columns. They identify discrepancies between SQLAlchemy models and the live database, then generate safe patches to resolve the errors.