Thread
Email conversation threads and thread messages.
Source: packages/db/src/schema/thread.ts
Enums
| Enum | Values |
|---|---|
thread_status | active, archived, closed |
message_direction | inbound, outbound |
email_thread
| Column | Type | Notes |
|---|---|---|
id | text | PK, prefix thr_ |
mailbox_id | text | FK → mailbox.id, CASCADE |
organization_id | text | FK → organization.id, CASCADE |
subject | text | |
last_message_preview | text | |
last_message_at | timestamp | |
status | thread_status | default active |
message_count | integer | default 0 |
participants | jsonb | default [] |
is_read | boolean | default false |
is_starred | boolean | default false |
created_at | timestamp | |
updated_at | timestamp |
thread_message
Links an inbound or outbound email to a thread. Exactly one of inbound_email_id or email_log_id is set.
| Column | Type | Notes |
|---|---|---|
id | text | PK, prefix tmsg_ |
thread_id | text | FK → email_thread.id, CASCADE |
direction | message_direction | NOT NULL |
inbound_email_id | text | FK → inbound_email.id, CASCADE |
email_log_id | text | FK → email_log.id, CASCADE |
from_email | varchar(255) | NOT NULL |
from_name | varchar(255) | |
subject | text | |
preview | text | |
message_at | timestamp | |
rfc822_message_id | text | |
in_reply_to | text | |
created_at | timestamp |
Was this page helpful?