- 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
1.3 KiB
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
- Make edits inside target SQLAlchemy model files.
- Run
alembic revision --autogenerate -m "description"to auto-detect changes. - Open the generated migration file and verify logic.
- Apply upgrades locally using
alembic upgrade head. - 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.