Loquent uses PostgreSQL with SeaORM 2.0. The schema is defined across 51 migrations and produces 24 entity tables.
| Table | Purpose |
|---|
user | User accounts |
email_password_account | Email/password credentials linked to users |
session | Active sessions with expiry, references member |
organization | Multi-tenant orgs (Twilio creds, client lookup config, report toggles) |
member | User ↔ Organization membership |
| Table | Purpose |
|---|
phone_number | Twilio phone numbers, each assigned to an org and optionally an agent |
phone_number_analyzer | Join: which analyzers are active on which phone numbers |
| Table | Purpose |
|---|
agent | AI voice agents — name, prompt, realtime_config (JSONB) |
agent_knowledge | Join: which knowledge bases are linked to which agents |
| Table | Purpose |
|---|
call | Call records — SID, phone number, contact, recording URL, transcription |
call_analysis | Analysis runs against call transcriptions |
| Table | Purpose |
|---|
analyzer | Org-level analyzer config — name, prompt, default flag |
system_analyzer | Platform-wide system analyzers |
system_call_analysis | System analyzer results |
| Table | Purpose |
|---|
contact | Contacts auto-resolved from callers |
contact_phone | Phone numbers associated with a contact |
contact_email | Email addresses associated with a contact |
| Table | Purpose |
|---|
knowledge | Knowledge base definitions |
knowledge_document | Documents within a knowledge base (title, description, content) |
| Table | Purpose |
|---|
todo_type | To-do type definitions with extraction prompts |
todo_type_tool | Tools available for AI to-do execution |
todo | Extracted to-do items from calls |
| Table | Purpose |
|---|
core_conf | Single-row runtime config — API keys, provider settings, email config |
report_email_address | Email addresses receiving reports |
organization ─┬─ member ── user
├─ phone_number ── agent ── agent_knowledge ── knowledge
├─ contact ─┬─ contact_phone
└─ todo_type ── todo_type_tool
phone_number ── phone_number_analyzer ── analyzer
└─ call_analysis ── analyzer
knowledge ── knowledge_document
A single-row table holding all runtime configuration. Seeded during first migration from seed.env, then managed at runtime.
| Column Group | Fields |
|---|
| Twilio | twilio_main_sid, twilio_main_token |
| OpenAI | openai_api_key |
| Email | resend_api_key, email_domain, email_user_admin |
| Google/Gemini | google_project_id, google_client_email, google_private_key, google_location, google_token_uri |
SeaORM entity files are gitignored and generated from the live database schema:
# runs: sea-orm-cli generate entity -o src/bases/db/schemas --with-serde both
This produces one Rust file per table in src/bases/db/schemas/ with Serialize + Deserialize derives on all models. Must be re-run after any migration.