Skip to content

public.user_roles

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

PLATFORM-wide role grants (master_admin) — what is_master_admin() reads — Not: Org privilege — that is rbac_org_user_roles. This table is not org-scoped at all — See: docs/PLATFORM.md

Name Type Default Nullable Children Parents Comment
created_at timestamp with time zone now() false
id uuid gen_random_uuid() false
role app_role false
user_id uuid false
Name Definition
Identity, Tenancy & RBAC Org tenancy, contacts/auth linking, seats (organization_users), and M-7 RBAC.
Catalog §1. Seat holds presence only — privilege is rbac_org_user_roles, not
organization_users.role_type (dropped). First review: contacts ↔ contact_auth ↔
organization_users ↔ rbac_*.
Name Type Definition
user_roles_pkey PRIMARY KEY PRIMARY KEY (id)
user_roles_user_id_fkey FOREIGN KEY FOREIGN KEY (user_id) REFERENCES auth.users(id) ON DELETE CASCADE
user_roles_user_id_role_key UNIQUE UNIQUE (user_id, role)
Name Definition
user_roles_pkey CREATE UNIQUE INDEX user_roles_pkey ON public.user_roles USING btree (id)
user_roles_user_id_role_key CREATE UNIQUE INDEX user_roles_user_id_role_key ON public.user_roles USING btree (user_id, role)
erDiagram


"public.user_roles" {
}

Generated by tbls