Database & Alembic Operations
When to use
- Running or debugging Alembic migrations
- Inspecting
entities, entity_relations, import_jobs state
- Updating schema or indexes
- Investigating migration/startup failures
Migrations
Canonical command (repo root):
alembic -c alembic.ini upgrade head
Important:
- Migrations are also applied automatically when backend starts (lifespan hook). If backend appears βstuckβ, it may be running migrations.
- NEVER CANCEL a migration command once started.
Collapsed migration history
This repo uses a collapsed history model. For clean DBs, upgrade head is the expected flow.
If youβre dealing with a historical DB/schema mismatch, follow the guidance in backend/README.md / docs/dev.md rather than guessing.
Common troubleshooting
Related docs