Skip to content

public.user_module_overlays

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

Per-user module grant/deny overlay on top of the org’s enabled set — Not: org_enabled_modules (org-wide); this is one contact’s exception

Name Type Default Nullable Children Parents Comment
contact_id uuid false public.contacts
created_at timestamp with time zone now() false
effect module_overlay_effect false
granted_by uuid true public.contacts
id uuid gen_random_uuid() false
module_key text false workspace_modules
notes text true
org_id text false organizations
updated_at timestamp with time zone now() false
Name Type Definition
user_module_overlays_contact_id_fkey FOREIGN KEY FOREIGN KEY (contact_id) REFERENCES contacts(id) ON DELETE CASCADE
user_module_overlays_granted_by_fkey FOREIGN KEY FOREIGN KEY (granted_by) REFERENCES contacts(id) ON DELETE SET NULL
user_module_overlays_module_key_fkey FOREIGN KEY FOREIGN KEY (module_key) REFERENCES workspace_modules(module_key)
user_module_overlays_org_id_fkey FOREIGN KEY FOREIGN KEY (org_id) REFERENCES organizations(id)
user_module_overlays_pkey PRIMARY KEY PRIMARY KEY (id)
Name Definition
idx_user_module_overlays_contact_org CREATE INDEX idx_user_module_overlays_contact_org ON public.user_module_overlays USING btree (contact_id, org_id)
user_module_overlays_pkey CREATE UNIQUE INDEX user_module_overlays_pkey ON public.user_module_overlays USING btree (id)
user_module_overlays_unique CREATE UNIQUE INDEX user_module_overlays_unique ON public.user_module_overlays USING btree (org_id, contact_id, module_key)
erDiagram

"public.user_module_overlays" }o--|| "public.contacts" : "FOREIGN KEY (contact_id) REFERENCES contacts(id) ON DELETE CASCADE"
"public.user_module_overlays" }o--o| "public.contacts" : "FOREIGN KEY (granted_by) REFERENCES contacts(id) ON DELETE SET NULL"
"public.user_module_overlays" }o--|| "public.workspace_modules" : "FOREIGN KEY (module_key) REFERENCES workspace_modules(module_key)"
"public.user_module_overlays" }o--|| "public.organizations" : "FOREIGN KEY (org_id) REFERENCES organizations(id)"

"public.user_module_overlays" {
  uuid contact_id FK ""
  uuid granted_by FK ""
  text module_key FK ""
  text org_id FK ""
}
"public.contacts" {
  uuid id ""
  text primary_org_id FK ""
  text source_org_id FK ""
}
"public.workspace_modules" {
  text module_key ""
}
"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