Skip to main content

Entity-Relationship Diagram


Entity Details

Table: users  |  File: app/db/models/user.py
ColumnTypeConstraintsDescription
idStringPK, UUIDUser identifier
emailStringUnique, NOT NULLLogin email
is_activeBooleanDefault: TrueAccount active status
superuserBooleanDefault: FalsePlatform admin flag
permissionsJSONNullableCustom permissions
creditFloatDefault: 0Account credit balance
current_workspace_idUUIDFK → workspaces.idActive workspace
created_atDateTimeDefault: nowRegistration time

Migration Strategy

Tool: Alembic (directory: agent-studio-backend/alembic/)
# Generate migration from model changes
alembic revision --autogenerate -m "description"

# Apply migration
alembic upgrade head

# Rollback one step
alembic downgrade -1

Data Lifecycle

EntityCreatedUpdatedDeleted
AgentPOST /agentsPUT /agents/{id}Hard delete + cascade
Call LogAgent worker post-callOnly notes fieldNot exposed via API
Batch ItemCSV upload → bulk insertDispatcher updates statusCascade with BatchJob
SIPPurchase or trunk registerDelete + recreate LiveKitDELETE /phonenumbers/delete_sip
CampaignPOST /api/v/campaign/PATCH /api/v/campaign/{slug}/DELETE /api/v/campaign/{slug}/
ProspectCSV upload → ProspectListUploadDisposition applied on callResolved or expired
ProspectListCreated with campaignPriority/name updateCascade with campaign