ifixkart-admin/.agents/skills/database_migrations/SKILL.md
Adithiyan bbd3a3e959 feat: initial commit — full platform snapshot
- Backend: FastAPI app with all models, services, schemas, routes
- Admin Panel: Next.js dashboard with all modules
  (CRM, POS, repairs, warranties, billing, notifications, etc.)
- Ecommerce: storefront (submodule) + product catalog
- AI Agents: .agents/ skill library for Antigravity IDE
- Docs: architecture, billing, notification gateway markdown
- Submodules: Backend/OpenWA, Ecommerce/File 2/storefront
2026-10-13 12:59:47 +05:30

1.3 KiB

name description
Database Migrations Manage database schema migrations using Alembic in Python

Skill: Database Migrations

1. Purpose

To modify the database schemas cleanly and safely, ensuring tables remain in-sync across dev, staging, and production environments.

2. When to Use

When changing fields, constraints, relations, or tables in the SQLAlchemy ORM models.

3. Preconditions

  • alembic.ini configured and pointing to database instances.
  • SQLAlchemy models imported in migration script env.py.

4. Step-by-Step Checklist

  1. Make edits inside target SQLAlchemy model files.
  2. Run alembic revision --autogenerate -m "description" to auto-detect changes.
  3. Open the generated migration file and verify logic.
  4. Apply upgrades locally using alembic upgrade head.
  5. Verify tables compile in MySQL.

5. Validation Checklist

  • Alembic version matches latest migration hash.
  • Database compiles successfully with zero data truncation warnings.

6. Examples

# Generate migration:
alembic revision --autogenerate -m "add_technician_rating"
# Apply upgrade:
alembic upgrade head

7. Failure Cases

  • Making manual DDL edits in MySQL directly, causing Alembic versions to go out-of-sync.
  • Running migrations containing non-nullable column additions without default values on existing tables.