Skip to content

public.commerce_products

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

Sellable SKU catalog (platform / association / org-owned products) — Not: Chamber member benefit definitions; external product keys — See: docs/decisions/2581-modules-vs-entitlements-vs-rls.md

Name Type Default Nullable Children Parents Comment
billing_frequency text ‘monthly’::text true
billing_model text ‘recurring’::text false
created_at timestamp with time zone now() false
currency text ‘usd’::text false
description text ‘’::text true
id uuid gen_random_uuid() false billing_agreements public.commerce_entitlements plan_price_variants plan_proposals product_bundle_rules seat_allocations
included_seats integer 0 true
is_active boolean true false
metadata_json jsonb ‘{}’::jsonb true
name text false
owner_id text ‘’::text false
owner_type text false
plan_track text ‘organization’::text false
price numeric 0 false
product_category text ‘membership’::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).
Name Type Definition
commerce_products_billing_frequency_check CHECK CHECK ((billing_frequency = ANY (ARRAY[‘monthly’::text, ‘quarterly’::text, ‘annual’::text, ‘one_time’::text, NULL::text])))
commerce_products_billing_model_check CHECK CHECK ((billing_model = ANY (ARRAY[‘recurring’::text, ‘one_time’::text, ‘usage’::text, ‘tiered’::text])))
commerce_products_owner_type_check CHECK CHECK ((owner_type = ANY (ARRAY[‘platform’::text, ‘association’::text, ‘organization’::text])))
commerce_products_pkey PRIMARY KEY PRIMARY KEY (id)
Name Definition
commerce_products_pkey CREATE UNIQUE INDEX commerce_products_pkey ON public.commerce_products USING btree (id)
Name Definition
commerce_products_updated_at CREATE TRIGGER commerce_products_updated_at BEFORE UPDATE ON public.commerce_products FOR EACH ROW EXECUTE FUNCTION update_updated_at_column()
erDiagram

"public.billing_agreements" }o--|| "public.commerce_products" : "FOREIGN KEY (product_id) REFERENCES commerce_products(id) ON DELETE RESTRICT"
"public.commerce_entitlements" }o--|| "public.commerce_products" : "FOREIGN KEY (product_id) REFERENCES commerce_products(id) ON DELETE RESTRICT"
"public.plan_price_variants" }o--|| "public.commerce_products" : "FOREIGN KEY (product_id) REFERENCES commerce_products(id) ON DELETE CASCADE"
"public.plan_proposals" }o--o| "public.commerce_products" : "FOREIGN KEY (base_product_id) REFERENCES commerce_products(id)"
"public.product_bundle_rules" }o--|| "public.commerce_products" : "FOREIGN KEY (child_product_id) REFERENCES commerce_products(id) ON DELETE CASCADE"
"public.product_bundle_rules" }o--|| "public.commerce_products" : "FOREIGN KEY (parent_product_id) REFERENCES commerce_products(id) ON DELETE CASCADE"
"public.seat_allocations" }o--|| "public.commerce_products" : "FOREIGN KEY (product_id) REFERENCES commerce_products(id) ON DELETE RESTRICT"

"public.commerce_products" {
  uuid id ""
}
"public.billing_agreements" {
  uuid id ""
  uuid product_id FK ""
}
"public.commerce_entitlements" {
  uuid billing_agreement_id FK ""
  uuid product_id FK ""
}
"public.plan_price_variants" {
  uuid product_id FK ""
}
"public.plan_proposals" {
  uuid base_product_id FK ""
  uuid converted_agreement_id FK ""
}
"public.product_bundle_rules" {
  uuid child_product_id FK ""
  uuid parent_product_id FK ""
}
"public.seat_allocations" {
  uuid billing_agreement_id FK ""
  uuid product_id FK ""
}

Generated by tbls