Skip to content

public.email_webhook_events

Synced from docs/generated/erd/ — do not hand-edit.
Regenerate with bun run docs:erd (needs staging reader), then this script runs automatically.
Labels: docs/db/erd-table-labels.yml · Runbook: docs/runbooks/erd-schema-docs.md

Raw inbound Resend webhook payloads (svix_id, resend_email_id) — Not: email_events — the first-party engagement table

Name Type Default Nullable Children Parents Comment
created_at timestamp with time zone now() true
event_type text false
id uuid gen_random_uuid() false
org_id text true organizations Attributed org. NULL when attribution is unknown at ingest (log-not-yet-committed race) or for BYOK orgs whose events fire on their own account.
payload jsonb false
recipient_email text true
resend_email_id text true Resend email id from the event payload. Joins email_send_log.message_id to inherit org_id (primary attribution path).
svix_id text false Svix message id. Unique — INSERT … ON CONFLICT (svix_id) DO NOTHING guarantees a webhook retry cannot double-count counters.
Name Definition
Communications & Journeys Email campaigns, segments, templates, send/hygiene state,
and journey engine (journeys/nodes/edges/runs). Catalog §4.1, §4.4.
# email_automations + automation_executions dropped #2213 (P3 UNIT 2) —
# journeys.* is the live automation surface; do not re-list those tables here.
Name Type Definition
email_webhook_events_org_id_fkey FOREIGN KEY FOREIGN KEY (org_id) REFERENCES organizations(id) ON DELETE SET NULL
email_webhook_events_pkey PRIMARY KEY PRIMARY KEY (id)
Name Definition
email_webhook_events_pkey CREATE UNIQUE INDEX email_webhook_events_pkey ON public.email_webhook_events USING btree (id)
email_webhook_events_svix_id_key CREATE UNIQUE INDEX email_webhook_events_svix_id_key ON public.email_webhook_events USING btree (svix_id)
idx_email_webhook_events_org_created CREATE INDEX idx_email_webhook_events_org_created ON public.email_webhook_events USING btree (org_id, created_at DESC)
idx_email_webhook_events_resend_email_id CREATE INDEX idx_email_webhook_events_resend_email_id ON public.email_webhook_events USING btree (resend_email_id) WHERE (resend_email_id IS NOT NULL)
erDiagram

"public.email_webhook_events" }o--o| "public.organizations" : "FOREIGN KEY (org_id) REFERENCES organizations(id) ON DELETE SET NULL"

"public.email_webhook_events" {
  text org_id FK "Attributed org. NULL when attribution is unknown at ingest (log-not-yet-committed race) or for BYOK orgs whose events fire on their own account."
}
"public.organizations" {
  text association_id FK ""
  uuid default_approval_reviewer_contact_id FK "Org-level fallback reviewer for two-step send (#5698). Routing chain: the sender's own reviewer, then this, then all org admins. NULL means fall through to the admins, which is the pre-#5698 behaviour."
  text id ""
  text parent_org_id FK "#671 self-referencing hierarchy pointer. NULL = root org. Direct writes are blocked by trg_block_direct_parent_org_id_writes for every role except service_role/postgres/supabase_admin — the only write path for authenticated/interactive callers is public.reparent_organization(). Cycle-prevented by trg_prevent_org_hierarchy_cycle. #quot;Is association#quot; is derived (EXISTS a child), never stored."
}

Generated by tbls