Skip to content

public.members

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

Member identity hub row (org-scoped); satellites hold profile/billing/metrics — Not: Full member payload — write profiles/billing/metrics to their tables — See: docs/PLATFORM.md

Name Type Default Nullable Children Parents Comment
cancelled_at timestamp with time zone true Set when membership_status transitions to ‘cancelled’. Cleared when the member is re-engaged (status moves back to active/pending). NULL for any cancelled-status member that predates this column.
company_id uuid true companies
contact_id uuid false public.contacts
created_at timestamp with time zone now() false
crm_owner_staff_id uuid true
id uuid gen_random_uuid() false assessments badge_print_log billing_dunning_state billing_subscriptions bullseye_member_intelligence bullseye_member_intelligence_admin bullseye_progress canonical_identities certifications chamber_event_registrations chamber_event_waitlist cohort_members cohort_referrals connection_directives connection_outcomes connector_roles contact_invitations content_campaign_targets course_enrollments cross_product_event_ledger digest_referrals digest_tokens public.email_events email_inbound public.email_send_log email_unsubscribes engagement_events erasure_requests event_connection_intents event_connection_suggestions event_feedback event_speakers event_staff_assignments forum_follows forum_reactions forum_replies forum_reports forum_saved_posts forum_threads group_members groups growth_group_members growth_groups hot_deals intro_requests invoices job_postings learning_engagement_events location_bookings locations member_activation_milestones member_activity_feed public.member_billing member_comm_preferences member_contributions public.member_entitlements member_external_access member_growth_group_interest member_interest_tags public.member_metrics member_milestones member_preferences member_product_accounts public.member_product_entitlements public.member_profiles member_progress member_referrals public.member_role_assignments member_social_handles member_success_goals member_success_plans membership_applications membership_unit_members membership_units notifications offer_redemptions opportunity_recommendations payments product_invite_queue product_sync_event_log prospects recommended_interventions referral_matches registration_form_submissions renewal_risks short_link_visits short_links sponsorship_credit_balances sponsorship_credit_ledger sponsorships success_plan_items support_tickets tracked_links tribespring_signals value_events
job_title text ‘member’::text false
lapsed_at timestamp with time zone true Set when membership_status transitions to ‘lapsed’. Cleared when the member is re-engaged (status moves back to active/pending). NULL for any lapsed-status member that predates this column, or when status never passed through lapsed. Scorecard lapsed_30 reads this, not updated_at.
membership_status text ‘active’::text false
membership_type text ‘’::text false
org_id text ‘’::text false organizations
renewal_date date true
renewal_month text ‘’::text false
start_date text ‘’::text false
tags text[] ‘{}’::text[] true
tier text ‘None’::text false
updated_at timestamp with time zone now() false
Name Definition
Membership & Billing Members split-payload (members + member_profiles + member_billing + member_metrics),
tiers, commerce/billable offers, billing agreements/subscriptions/transactions.
Catalog §2.1–2.2, 2.4. Strong first-review cluster for Nathan/Craig.
NAMING TRAP — “entitlement” is three different concepts (see docs/db/erd-table-labels.yml):
commerce_entitlements = plan/agreement commercial limits;
member_entitlements = chamber member benefit allocations;
member_product_entitlements = external product provisioning (e.g. Bullseye).
The bare entitlements table is NOT the commerce ledger (ADR #2581).
Events & Registration Chamber events, ticket types, registrations, check-ins, sessions/speakers,
promo codes, registration forms, signature events (core). Catalog §3.1.
Sponsorships Sponsorship offerings and bookings, event sponsor slots/fulfillment,
sponsor impressions/placements, package benefits. Catalog §2.3.
(Table names on staging: sponsorships / sponsorship_offerings — not
sponsorship_inventory from older prose.)
Name Type Definition
fk_members_org FOREIGN KEY FOREIGN KEY (org_id) REFERENCES organizations(id)
members_company_id_fkey FOREIGN KEY FOREIGN KEY (company_id) REFERENCES companies(id)
members_contact_id_fkey FOREIGN KEY FOREIGN KEY (contact_id) REFERENCES contacts(id) ON DELETE CASCADE
members_crm_owner_staff_id_fkey FOREIGN KEY FOREIGN KEY (crm_owner_staff_id) REFERENCES auth.users(id) ON DELETE SET NULL
members_pkey PRIMARY KEY PRIMARY KEY (id)
Name Definition
idx_members_cancelled_at CREATE INDEX idx_members_cancelled_at ON public.members USING btree (org_id, cancelled_at DESC) WHERE (membership_status = ‘cancelled’::text)
idx_members_company_id CREATE INDEX idx_members_company_id ON public.members USING btree (company_id)
idx_members_crm_owner CREATE INDEX idx_members_crm_owner ON public.members USING btree (crm_owner_staff_id) WHERE (crm_owner_staff_id IS NOT NULL)
idx_members_lapsed_at CREATE INDEX idx_members_lapsed_at ON public.members USING btree (org_id, lapsed_at DESC) WHERE (membership_status = ‘lapsed’::text)
idx_members_org CREATE INDEX idx_members_org ON public.members USING btree (org_id)
idx_members_org_id CREATE INDEX idx_members_org_id ON public.members USING btree (org_id)
idx_members_org_status CREATE INDEX idx_members_org_status ON public.members USING btree (org_id, membership_status)
members_pkey CREATE UNIQUE INDEX members_pkey ON public.members USING btree (id)
uniq_active_membership CREATE UNIQUE INDEX uniq_active_membership ON public.members USING btree (contact_id, org_id) WHERE (membership_status = ‘active’::text)
Name Definition
trg_bullseye_member_lifecycle CREATE TRIGGER trg_bullseye_member_lifecycle AFTER INSERT OR UPDATE OF membership_status, membership_type ON public.members FOR EACH ROW EXECUTE FUNCTION notify_bullseye_member_lifecycle()
trg_enqueue_simpletexting_sync CREATE TRIGGER trg_enqueue_simpletexting_sync AFTER INSERT OR DELETE OR UPDATE ON public.members FOR EACH ROW EXECUTE FUNCTION enqueue_simpletexting_sync_member()
trg_evaluate_bullseye_eligibility CREATE TRIGGER trg_evaluate_bullseye_eligibility AFTER INSERT OR UPDATE OF membership_status, org_id, contact_id ON public.members FOR EACH ROW EXECUTE FUNCTION trigger_evaluate_bullseye_eligibility()
trg_members_enroll_member_joins CREATE TRIGGER trg_members_enroll_member_joins AFTER INSERT OR UPDATE OF membership_status ON public.members FOR EACH ROW EXECUTE FUNCTION trg_members_enroll_member_joins()
trg_notify_new_member CREATE TRIGGER trg_notify_new_member AFTER INSERT ON public.members FOR EACH ROW EXECUTE FUNCTION notify_new_member()
trg_stamp_member_lapsed_at CREATE TRIGGER trg_stamp_member_lapsed_at BEFORE INSERT OR UPDATE OF membership_status ON public.members FOR EACH ROW EXECUTE FUNCTION stamp_member_lapsed_at()
update_members_updated_at CREATE TRIGGER update_members_updated_at BEFORE UPDATE ON public.members FOR EACH ROW EXECUTE FUNCTION update_updated_at_column()
erDiagram

"public.members" }o--o| "public.companies" : "FOREIGN KEY (company_id) REFERENCES companies(id)"
"public.members" }o--|| "public.contacts" : "FOREIGN KEY (contact_id) REFERENCES contacts(id) ON DELETE CASCADE"
"public.assessments" }o--o| "public.members" : "FOREIGN KEY (member_id) REFERENCES members(id) ON DELETE SET NULL"
"public.badge_print_log" }o--o| "public.members" : "FOREIGN KEY (member_id) REFERENCES members(id) ON DELETE CASCADE"
"public.billing_dunning_state" }o--|| "public.members" : "FOREIGN KEY (member_id) REFERENCES members(id) ON DELETE RESTRICT"
"public.billing_subscriptions" }o--o| "public.members" : "FOREIGN KEY (member_id) REFERENCES members(id) ON DELETE RESTRICT"
"public.bullseye_member_intelligence" |o--o| "public.members" : "FOREIGN KEY (member_id) REFERENCES members(id) ON DELETE CASCADE"
"public.bullseye_member_intelligence_admin" |o--o| "public.members" : "FOREIGN KEY (member_id) REFERENCES members(id) ON DELETE CASCADE"
"public.bullseye_progress" }o--o| "public.members" : "FOREIGN KEY (member_id) REFERENCES members(id) ON DELETE SET NULL"
"public.canonical_identities" |o--o| "public.members" : "FOREIGN KEY (member_id) REFERENCES members(id) ON DELETE SET NULL"
"public.certifications" }o--o| "public.members" : "FOREIGN KEY (member_id) REFERENCES members(id) ON DELETE SET NULL"
"public.chamber_event_registrations" }o--o| "public.members" : "FOREIGN KEY (member_id) REFERENCES members(id) ON DELETE SET NULL"
"public.chamber_event_waitlist" }o--o| "public.members" : "FOREIGN KEY (member_id) REFERENCES members(id) ON DELETE SET NULL"
"public.cohort_members" }o--o| "public.members" : "FOREIGN KEY (member_id) REFERENCES members(id) ON DELETE SET NULL"
"public.cohort_referrals" }o--|| "public.members" : "FOREIGN KEY (from_member_id) REFERENCES members(id) ON DELETE CASCADE"
"public.cohort_referrals" }o--o| "public.members" : "FOREIGN KEY (to_member_id) REFERENCES members(id) ON DELETE SET NULL"
"public.connection_directives" }o--|| "public.members" : "FOREIGN KEY (from_member_id) REFERENCES members(id) ON DELETE CASCADE"
"public.connection_directives" }o--o| "public.members" : "FOREIGN KEY (to_member_id) REFERENCES members(id) ON DELETE SET NULL"
"public.connection_outcomes" }o--o| "public.members" : "FOREIGN KEY (related_member_id) REFERENCES members(id)"
"public.connector_roles" |o--|| "public.members" : "FOREIGN KEY (member_id) REFERENCES members(id) ON DELETE CASCADE"
"public.contact_invitations" }o--o| "public.members" : "FOREIGN KEY (member_id) REFERENCES members(id) ON DELETE CASCADE"
"public.content_campaign_targets" }o--o| "public.members" : "FOREIGN KEY (member_id) REFERENCES members(id) ON DELETE CASCADE"
"public.course_enrollments" }o--o| "public.members" : "FOREIGN KEY (member_id) REFERENCES members(id) ON DELETE SET NULL"
"public.cross_product_event_ledger" }o--o| "public.members" : "FOREIGN KEY (member_id) REFERENCES members(id) ON DELETE SET NULL"
"public.digest_referrals" }o--o| "public.members" : "FOREIGN KEY (referred_member_id) REFERENCES members(id) ON DELETE SET NULL"
"public.digest_referrals" }o--|| "public.members" : "FOREIGN KEY (referrer_member_id) REFERENCES members(id) ON DELETE CASCADE"
"public.digest_tokens" }o--|| "public.members" : "FOREIGN KEY (member_id) REFERENCES members(id) ON DELETE CASCADE"
"public.email_events" }o--o| "public.members" : "FOREIGN KEY (member_id) REFERENCES members(id) ON DELETE SET NULL"
"public.email_inbound" }o--o| "public.members" : "FOREIGN KEY (member_id) REFERENCES members(id) ON DELETE SET NULL"
"public.email_send_log" }o--o| "public.members" : "FOREIGN KEY (member_id) REFERENCES members(id) ON DELETE SET NULL"
"public.email_unsubscribes" }o--o| "public.members" : "FOREIGN KEY (member_id) REFERENCES members(id) ON DELETE CASCADE"
"public.engagement_events" }o--o| "public.members" : "FOREIGN KEY (member_id) REFERENCES members(id) ON DELETE SET NULL"
"public.erasure_requests" }o--o| "public.members" : "FOREIGN KEY (member_id) REFERENCES members(id) ON DELETE SET NULL"
"public.event_connection_intents" }o--o| "public.members" : "FOREIGN KEY (member_id) REFERENCES members(id) ON DELETE SET NULL"
"public.event_connection_suggestions" }o--|| "public.members" : "FOREIGN KEY (member_a_id) REFERENCES members(id) ON DELETE CASCADE"
"public.event_connection_suggestions" }o--|| "public.members" : "FOREIGN KEY (member_b_id) REFERENCES members(id) ON DELETE CASCADE"
"public.event_feedback" }o--o| "public.members" : "FOREIGN KEY (member_id) REFERENCES members(id) ON DELETE SET NULL"
"public.event_speakers" }o--o| "public.members" : "FOREIGN KEY (member_id) REFERENCES members(id) ON DELETE SET NULL"
"public.event_staff_assignments" }o--o| "public.members" : "FOREIGN KEY (member_id) REFERENCES members(id) ON DELETE SET NULL"
"public.forum_follows" }o--|| "public.members" : "FOREIGN KEY (member_id) REFERENCES members(id) ON DELETE CASCADE"
"public.forum_reactions" }o--|| "public.members" : "FOREIGN KEY (member_id) REFERENCES members(id) ON DELETE CASCADE"
"public.forum_replies" }o--o| "public.members" : "FOREIGN KEY (member_id) REFERENCES members(id) ON DELETE SET NULL"
"public.forum_reports" }o--o| "public.members" : "FOREIGN KEY (member_id) REFERENCES members(id) ON DELETE SET NULL"
"public.forum_saved_posts" }o--|| "public.members" : "FOREIGN KEY (member_id) REFERENCES members(id) ON DELETE CASCADE"
"public.forum_threads" }o--o| "public.members" : "FOREIGN KEY (member_id) REFERENCES members(id) ON DELETE SET NULL"
"public.group_members" }o--o| "public.members" : "FOREIGN KEY (member_id) REFERENCES members(id) ON DELETE SET NULL"
"public.groups" }o--o| "public.members" : "FOREIGN KEY (chair_member_id) REFERENCES members(id) ON DELETE SET NULL"
"public.growth_group_members" }o--o| "public.members" : "FOREIGN KEY (member_id) REFERENCES members(id) ON DELETE SET NULL"
"public.growth_groups" }o--o| "public.members" : "FOREIGN KEY (facilitator_id) REFERENCES members(id) ON DELETE SET NULL"
"public.hot_deals" }o--o| "public.members" : "FOREIGN KEY (member_id) REFERENCES members(id) ON DELETE SET NULL"
"public.intro_requests" }o--o| "public.members" : "FOREIGN KEY (target_member_id) REFERENCES members(id) ON DELETE SET NULL"
"public.invoices" }o--o| "public.members" : "FOREIGN KEY (member_id) REFERENCES members(id) ON DELETE SET NULL"
"public.job_postings" }o--o| "public.members" : "FOREIGN KEY (member_id) REFERENCES members(id) ON DELETE SET NULL"
"public.learning_engagement_events" }o--o| "public.members" : "FOREIGN KEY (member_id) REFERENCES members(id) ON DELETE SET NULL"
"public.location_bookings" }o--o| "public.members" : "FOREIGN KEY (booked_for_member_id) REFERENCES members(id) ON DELETE SET NULL"
"public.locations" }o--o| "public.members" : "FOREIGN KEY (offered_by_member_id) REFERENCES members(id) ON DELETE SET NULL"
"public.member_activation_milestones" }o--o| "public.members" : "FOREIGN KEY (member_id) REFERENCES members(id) ON DELETE SET NULL"
"public.member_activity_feed" }o--o| "public.members" : "FOREIGN KEY (member_id) REFERENCES members(id) ON DELETE SET NULL"
"public.member_billing" |o--|| "public.members" : "FOREIGN KEY (member_id) REFERENCES members(id) ON DELETE CASCADE"
"public.member_comm_preferences" |o--|| "public.members" : "FOREIGN KEY (member_id) REFERENCES members(id) ON DELETE CASCADE"
"public.member_contributions" }o--o| "public.members" : "FOREIGN KEY (member_id) REFERENCES members(id) ON DELETE SET NULL"
"public.member_entitlements" }o--o| "public.members" : "FOREIGN KEY (member_id) REFERENCES members(id) ON DELETE SET NULL"
"public.member_external_access" }o--o| "public.members" : "FOREIGN KEY (member_id) REFERENCES members(id) ON DELETE SET NULL"
"public.member_growth_group_interest" }o--|| "public.members" : "FOREIGN KEY (member_id) REFERENCES members(id) ON DELETE CASCADE"
"public.member_interest_tags" }o--|| "public.members" : "FOREIGN KEY (member_id) REFERENCES members(id) ON DELETE CASCADE"
"public.member_metrics" |o--|| "public.members" : "FOREIGN KEY (member_id) REFERENCES members(id) ON DELETE CASCADE"
"public.member_milestones" }o--o| "public.members" : "FOREIGN KEY (member_id) REFERENCES members(id) ON DELETE SET NULL"
"public.member_preferences" |o--|| "public.members" : "FOREIGN KEY (member_id) REFERENCES members(id) ON DELETE CASCADE"
"public.member_product_accounts" }o--|| "public.members" : "FOREIGN KEY (member_id) REFERENCES members(id) ON DELETE CASCADE"
"public.member_product_entitlements" }o--|| "public.members" : "FOREIGN KEY (member_id) REFERENCES members(id) ON DELETE CASCADE"
"public.member_profiles" |o--|| "public.members" : "FOREIGN KEY (member_id) REFERENCES members(id) ON DELETE CASCADE"
"public.member_progress" }o--o| "public.members" : "FOREIGN KEY (member_id) REFERENCES members(id) ON DELETE SET NULL"
"public.member_referrals" }o--o| "public.members" : "FOREIGN KEY (member_id) REFERENCES members(id) ON DELETE SET NULL"
"public.member_referrals" }o--o| "public.members" : "FOREIGN KEY (referred_member_id) REFERENCES members(id) ON DELETE SET NULL"
"public.member_role_assignments" }o--|| "public.members" : "FOREIGN KEY (member_id) REFERENCES members(id) ON DELETE CASCADE"
"public.member_social_handles" }o--|| "public.members" : "FOREIGN KEY (member_id) REFERENCES members(id) ON DELETE CASCADE"
"public.member_success_goals" }o--|| "public.members" : "FOREIGN KEY (member_id) REFERENCES members(id) ON DELETE CASCADE"
"public.member_success_plans" |o--|| "public.members" : "FOREIGN KEY (member_id) REFERENCES members(id) ON DELETE CASCADE"
"public.membership_applications" }o--o| "public.members" : "FOREIGN KEY (member_id) REFERENCES members(id) ON DELETE SET NULL"
"public.membership_unit_members" }o--|| "public.members" : "FOREIGN KEY (member_id) REFERENCES members(id) ON DELETE CASCADE"
"public.membership_units" }o--o| "public.members" : "FOREIGN KEY (owner_member_id) REFERENCES members(id) ON DELETE SET NULL"
"public.notifications" }o--o| "public.members" : "FOREIGN KEY (recipient_member_id) REFERENCES members(id) ON DELETE CASCADE"
"public.offer_redemptions" }o--o| "public.members" : "FOREIGN KEY (member_id) REFERENCES members(id) ON DELETE SET NULL"
"public.opportunity_recommendations" }o--o| "public.members" : "FOREIGN KEY (member_id) REFERENCES members(id) ON DELETE SET NULL"
"public.payments" }o--o| "public.members" : "FOREIGN KEY (member_id) REFERENCES members(id) ON DELETE SET NULL"
"public.product_invite_queue" }o--o| "public.members" : "FOREIGN KEY (member_id) REFERENCES members(id) ON DELETE SET NULL"
"public.product_sync_event_log" }o--o| "public.members" : "FOREIGN KEY (member_id) REFERENCES members(id) ON DELETE SET NULL"
"public.prospects" }o--o| "public.members" : "FOREIGN KEY (converted_to_member_id) REFERENCES members(id) ON DELETE SET NULL"
"public.recommended_interventions" }o--o| "public.members" : "FOREIGN KEY (member_id) REFERENCES members(id) ON DELETE SET NULL"
"public.referral_matches" }o--o| "public.members" : "FOREIGN KEY (expert_member_id) REFERENCES members(id) ON DELETE SET NULL"
"public.referral_matches" }o--|| "public.members" : "FOREIGN KEY (member_id) REFERENCES members(id) ON DELETE CASCADE"
"public.registration_form_submissions" }o--o| "public.members" : "FOREIGN KEY (member_id) REFERENCES members(id)"
"public.renewal_risks" }o--o| "public.members" : "FOREIGN KEY (member_id) REFERENCES members(id) ON DELETE SET NULL"
"public.short_link_visits" }o--o| "public.members" : "FOREIGN KEY (member_id) REFERENCES members(id) ON DELETE SET NULL"
"public.short_links" }o--o| "public.members" : "FOREIGN KEY (created_by) REFERENCES members(id) ON DELETE SET NULL"
"public.sponsorship_credit_balances" }o--o| "public.members" : "FOREIGN KEY (member_id) REFERENCES members(id) ON DELETE CASCADE"
"public.sponsorship_credit_ledger" }o--o| "public.members" : "FOREIGN KEY (member_id) REFERENCES members(id) ON DELETE SET NULL"
"public.sponsorships" }o--o| "public.members" : "FOREIGN KEY (member_id) REFERENCES members(id) ON DELETE SET NULL"
"public.success_plan_items" }o--o| "public.members" : "FOREIGN KEY (member_id) REFERENCES members(id) ON DELETE SET NULL"
"public.support_tickets" }o--o| "public.members" : "FOREIGN KEY (member_id) REFERENCES members(id) ON DELETE SET NULL"
"public.tracked_links" }o--o| "public.members" : "FOREIGN KEY (member_id) REFERENCES members(id) ON DELETE SET NULL"
"public.tribespring_signals" }o--o| "public.members" : "FOREIGN KEY (actor_member_id) REFERENCES members(id) ON DELETE SET NULL"
"public.value_events" }o--o| "public.members" : "FOREIGN KEY (member_id) REFERENCES members(id) ON DELETE SET NULL"
"public.value_events" }o--o| "public.members" : "FOREIGN KEY (related_member_id) REFERENCES members(id) ON DELETE SET NULL"
"public.members" }o--|| "public.organizations" : "FOREIGN KEY (org_id) REFERENCES organizations(id)"

"public.members" {
  uuid company_id FK ""
  uuid contact_id FK ""
  uuid id ""
  text org_id FK ""
}
"public.companies" {
  uuid id ""
  text org_id FK ""
  uuid primary_contact_id FK ""
}
"public.contacts" {
  uuid id ""
  text primary_org_id FK ""
  text source_org_id FK ""
}
"public.assessments" {
  uuid member_id FK ""
}
"public.badge_print_log" {
  uuid member_id FK ""
  text org_id FK ""
}
"public.billing_dunning_state" {
  uuid billing_subscription_id FK ""
  uuid member_id FK ""
  text org_id FK ""
}
"public.billing_subscriptions" {
  uuid id ""
  uuid member_id FK ""
  uuid membership_unit_id FK ""
  text org_id FK ""
  uuid tier_id FK ""
}
"public.bullseye_member_intelligence" {
  uuid member_id FK ""
  text org_id FK ""
}
"public.bullseye_member_intelligence_admin" {
  uuid member_id FK ""
  text org_id FK ""
}
"public.bullseye_progress" {
  uuid member_id FK ""
  text org_id FK ""
}
"public.canonical_identities" {
  uuid member_id FK ""
  text org_id FK ""
}
"public.certifications" {
  uuid course_id FK ""
  uuid member_id FK ""
  text org_id FK ""
}
"public.chamber_event_registrations" {
  uuid contact_id FK "Identity root for a prospect registration. NULL on legacy / member rows. When member_id IS NULL AND contact_id IS NOT NULL, the row counts against org.comp_event_limit. Issue #1244."
  uuid event_id FK ""
  uuid id ""
  uuid member_id FK ""
  uuid ticket_type_id FK ""
}
"public.chamber_event_waitlist" {
  uuid event_id FK ""
  uuid member_id FK ""
  text org_id FK ""
  uuid registration_id FK ""
}
"public.cohort_members" {
  uuid cohort_id FK ""
  uuid member_id FK ""
  text org_id FK ""
}
"public.cohort_referrals" {
  uuid cohort_id FK ""
  uuid from_member_id FK ""
  text org_id FK ""
  uuid to_member_id FK ""
}
"public.connection_directives" {
  uuid from_member_id FK ""
  uuid id ""
  text org_id FK ""
  uuid to_member_id FK ""
}
"public.connection_outcomes" {
  uuid directive_id FK ""
  uuid event_id FK ""
  text org_id FK ""
  uuid related_member_id FK ""
}
"public.connector_roles" {
  uuid id ""
  uuid member_id FK ""
}
"public.contact_invitations" {
  uuid contact_id FK "The person being invited (canonical identity). Required."
  uuid member_id FK "Optional link to a members row when the invitee is already a member."
  text org_id FK ""
}
"public.content_campaign_targets" {
  uuid campaign_id FK ""
  uuid member_id FK ""
  text org_id FK ""
  uuid segment_id FK ""
}
"public.course_enrollments" {
  uuid course_id FK ""
  uuid member_id FK ""
  text org_id FK ""
}
"public.cross_product_event_ledger" {
  uuid member_id FK ""
  text org_id FK ""
}
"public.digest_referrals" {
  uuid digest_send_id FK ""
  text org_id FK ""
  uuid referred_member_id FK ""
  uuid referrer_member_id FK ""
}
"public.digest_tokens" {
  uuid digest_send_id FK ""
  uuid member_id FK ""
  text org_id FK ""
}
"public.email_events" {
  uuid campaign_id FK ""
  uuid member_id FK ""
  text org_id FK ""
}
"public.email_inbound" {
  uuid member_id FK ""
  text org_id FK "Tenant key when known (from send log or member). ON DELETE SET NULL so org wipe does not erase audit rows."
}
"public.email_send_log" {
  uuid member_id FK "Member binding when the recipient is a known member. Used for per-member email pref enforcement (#673) and analytics."
  text org_id FK "Org context for the email. NULL for platform-level emails (signup before user is org-bound). Drives RLS + per-org analytics (#679)."
}
"public.email_unsubscribes" {
  uuid member_id FK ""
  text org_id FK ""
}
"public.engagement_events" {
  uuid channel_variant_id FK ""
  uuid content_piece_id FK ""
  uuid member_id FK ""
  text org_id FK ""
  uuid tracked_link_id FK ""
}
"public.erasure_requests" {
  uuid id ""
  uuid member_id FK ""
  text org_id FK ""
}
"public.event_connection_intents" {
  uuid event_id FK ""
  uuid member_id FK ""
  text org_id FK ""
  uuid registration_id FK ""
}
"public.event_connection_suggestions" {
  uuid event_id FK ""
  uuid member_a_id FK ""
  uuid member_b_id FK ""
  text org_id FK ""
}
"public.event_feedback" {
  uuid event_id FK ""
  uuid id ""
  uuid member_id FK ""
  text org_id FK ""
  uuid registration_id FK ""
}
"public.event_speakers" {
  uuid event_id FK ""
  uuid member_id FK ""
  text org_id FK ""
}
"public.event_staff_assignments" {
  uuid contact_id FK "public.contacts is not org-scoped by a single column (source_org_id / primary_org_id only), so a same-org FK guard is not well-defined here the way it is for member_id. No guard added, matching #5313's scope."
  uuid event_id FK ""
  uuid id ""
  uuid member_id FK "KNOWN RESIDUAL, stated not built: no trigger or RLS check confirms the referenced member.org_id matches this row's org_id. A cross-org guard could follow 20260818160000's groups.meeting_location_id precedent; out of scope for #5313 and rated material-not-blocking by the adversarial pass on the first draft."
}
"public.forum_follows" {
  uuid member_id FK ""
}
"public.forum_reactions" {
  uuid member_id FK ""
}
"public.forum_replies" {
  uuid id ""
  uuid member_id FK ""
  text org_id FK ""
  uuid parent_reply_id FK "Parent reply for threaded/nested replies; NULL = top-level. Constrained to the same thread via forum_replies_parent_same_thread_fkey. #2837."
  uuid thread_id FK ""
}
"public.forum_reports" {
  uuid member_id FK ""
}
"public.forum_saved_posts" {
  uuid member_id FK ""
  uuid thread_id FK ""
}
"public.forum_threads" {
  uuid category_id FK ""
  uuid id ""
  uuid member_id FK ""
  text org_id FK ""
}
"public.group_members" {
  uuid group_id FK ""
  uuid member_id FK ""
}
"public.groups" {
  uuid chair_member_id FK ""
  uuid id ""
  uuid meeting_location_id FK "FK to the Location library (#3994) for a group that meets at a place the org already manages. NULL for a group whose meeting place is only meeting_location free text. Same-org membership is enforced by trg_groups_meeting_location_org_guard, not by the FK — no FK or CHECK can express a cross-table tenancy rule."
  text org_id FK ""
}
"public.growth_group_members" {
  uuid growth_group_id FK ""
  uuid member_id FK ""
}
"public.growth_groups" {
  uuid cohort_id FK ""
  uuid facilitator_id FK ""
  uuid id ""
  text org_id FK ""
}
"public.hot_deals" {
  uuid id ""
  uuid member_id FK ""
  text org_id FK ""
}
"public.intro_requests" {
  uuid assigned_connector_id FK ""
  text org_id FK ""
  uuid target_member_id FK ""
}
"public.invoices" {
  uuid billing_agreement_id FK ""
  uuid id ""
  uuid member_id FK ""
  text org_id FK ""
}
"public.job_postings" {
  uuid member_id FK ""
  text org_id FK ""
}
"public.learning_engagement_events" {
  uuid member_id FK ""
}
"public.location_bookings" {
  uuid booked_for_member_id FK ""
  uuid event_id FK ""
  uuid location_id FK ""
  uuid meeting_id FK ""
}
"public.locations" {
  uuid id ""
  uuid offered_by_member_id FK ""
  text org_id FK ""
}
"public.member_activation_milestones" {
  uuid member_id FK ""
}
"public.member_activity_feed" {
  uuid member_id FK ""
}
"public.member_billing" {
  uuid member_id FK ""
}
"public.member_comm_preferences" {
  uuid member_id FK ""
}
"public.member_contributions" {
  uuid member_id FK ""
}
"public.member_entitlements" {
  uuid benefit_definition_id FK ""
  uuid id ""
  uuid member_id FK ""
  text org_id FK ""
}
"public.member_external_access" {
  uuid member_id FK ""
  text org_id FK ""
}
"public.member_growth_group_interest" {
  uuid member_id FK ""
  text org_id FK ""
}
"public.member_interest_tags" {
  uuid member_id FK ""
  text org_id FK ""
}
"public.member_metrics" {
  uuid member_id FK ""
}
"public.member_milestones" {
  uuid member_id FK ""
  text org_id FK ""
}
"public.member_preferences" {
  uuid member_id FK ""
}
"public.member_product_accounts" {
  uuid member_id FK ""
}
"public.member_product_entitlements" {
  uuid member_id FK ""
}
"public.member_profiles" {
  uuid member_id FK ""
}
"public.member_progress" {
  uuid member_id FK ""
}
"public.member_referrals" {
  uuid group_id FK "The group this referral was given within (#4961 Phase 2), so #quot;referrals given within this group#quot; is answerable. NULL for every pre-existing referral and for any referral logged outside a group — the linkage is additive, never required. Same-org membership is enforced by trg_member_referrals_group_org_guard."
  uuid member_id FK ""
  text org_id FK ""
  uuid referred_member_id FK ""
}
"public.member_role_assignments" {
  uuid member_id FK ""
  text org_id FK ""
  uuid role_definition_id FK ""
}
"public.member_social_handles" {
  uuid member_id FK ""
  text org_id FK ""
}
"public.member_success_goals" {
  uuid member_id FK ""
}
"public.member_success_plans" {
  uuid id ""
  uuid member_id FK ""
}
"public.membership_applications" {
  uuid member_id FK ""
  text org_id FK ""
  uuid tier_id FK ""
}
"public.membership_unit_members" {
  uuid member_id FK ""
  uuid membership_unit_id FK ""
}
"public.membership_units" {
  uuid company_id FK ""
  uuid id ""
  text org_id FK ""
  uuid owner_member_id FK ""
}
"public.notifications" {
  uuid id ""
  text org_id FK ""
  uuid recipient_member_id FK "#2839: NULL = org-wide broadcast (unchanged behavior); non-null = visible only to that member (plus org admins via their manage policy). Written by community-notify (service role); same-org proven by trigger."
}
"public.offer_redemptions" {
  uuid deal_id FK ""
  uuid member_id FK ""
  text org_id FK ""
}
"public.opportunity_recommendations" {
  uuid member_id FK ""
}
"public.payments" {
  uuid billing_agreement_id FK ""
  uuid invoice_id FK ""
  uuid member_id FK ""
  text org_id FK ""
}
"public.product_invite_queue" {
  uuid member_id FK ""
}
"public.product_sync_event_log" {
  uuid member_id FK ""
}
"public.prospects" {
  uuid assigned_to_contact_id FK ""
  uuid contact_id FK ""
  uuid converted_to_member_id FK ""
  text org_id FK ""
  uuid referred_by_contact_id FK "Contact who referred this prospect (member or prospect subject). #4232 reciprocal CRM link."
}
"public.recommended_interventions" {
  uuid member_id FK ""
  text org_id FK ""
  uuid renewal_risk_id FK ""
}
"public.referral_matches" {
  uuid expert_member_id FK ""
  uuid member_id FK ""
  text org_id FK ""
}
"public.registration_form_submissions" {
  uuid cohort_id FK ""
  uuid company_id FK ""
  uuid event_id FK ""
  uuid form_id FK ""
  uuid member_id FK ""
  text org_id FK ""
}
"public.renewal_risks" {
  uuid id ""
  uuid member_id FK ""
  text org_id FK ""
}
"public.short_link_visits" {
  text code FK ""
  uuid member_id FK ""
}
"public.short_links" {
  text code ""
  uuid created_by FK ""
  text org_id FK ""
}
"public.sponsorship_credit_balances" {
  uuid company_id FK ""
  uuid member_id FK ""
  text org_id FK ""
}
"public.sponsorship_credit_ledger" {
  uuid billing_subscription_id FK ""
  uuid company_id FK ""
  uuid member_id FK ""
  text org_id FK ""
  uuid sponsorship_id FK ""
}
"public.sponsorships" {
  uuid company_id FK ""
  uuid event_id FK "#3542: set for an event-scoped sponsorship; NULL for an org-level one."
  uuid id ""
  uuid member_id FK ""
  uuid membership_unit_id FK ""
  uuid offering_id FK "#3542: FK to sponsorship_offerings (renamed from tier_id)."
  text org_id FK ""
  uuid signature_event_id FK ""
  uuid subscription_id FK ""
}
"public.success_plan_items" {
  uuid member_id FK ""
  uuid success_plan_id FK ""
}
"public.support_tickets" {
  uuid id ""
  uuid member_id FK ""
  text org_id FK ""
}
"public.tracked_links" {
  uuid campaign_id FK ""
  uuid channel_variant_id FK ""
  uuid content_piece_id FK ""
  uuid id ""
  uuid member_id FK ""
  text org_id FK ""
}
"public.tribespring_signals" {
  uuid actor_member_id FK ""
  text org_id FK ""
}
"public.value_events" {
  uuid company_id FK ""
  uuid event_id FK ""
  uuid member_id FK ""
  text org_id FK ""
  uuid related_member_id FK ""
}
"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