Unity ERP multi-tenancy (organizations) workflow. Use when adding org_id, backfilling data, tightening RLS, debugging "null nested relation" issues, or implementing tenant-scoped module access.
Scope: $ARGUMENTS
docs/README.mddocs/operations/tenant-data-isolation-zero-downtime-runbook.mddocs/operations/tenant-module-entitlements-runbook.mddocs/operations/tenant-rollout-status.mddocs/overview/todo-index.mdFollow the staged plan in the runbook. The intent is zero downtime and easy rollback:
org_idNOT VALIDorg_id IS NULL rows for the tables you touched.public.organization_members.VALIDATE CONSTRAINT on FKs once stable.SET NOT NULL on org_id.Supabase nested selects can return null for embedded objects when:
UI code must treat nested relations as nullable and avoid direct dereferences like:
row.supplier_component.component.internal_code
lib/api/org-context.tslib/api/module-access.tsorganization_members row, or