Overview
This document establishes consistent data model conventions for all CL (Clinical) and PM (Practice Management) tables, addressing gaps identified in the spec review.1. Required Columns for All Business Entity Tables
Per constitution Section 5.2.1, every business entity table MUST include:Tables Currently Missing Required Columns
Exception: Immutable Log Tables
Tables that are INSERT-only by design (audit logs, disclosure logs) may omitupdated_by and updated_at:
cl_disclosure_log(CL-11) — INSERT-only, no updates allowedcl_data_exchange_log(CL-16) — INSERT-onlypf_audit_logs— INSERT-only
2. Soft-Delete Policy
Policy
Implementation
Tables Currently Missing deleted_at
3. RLS Helper Function Naming Convention
Standard Pattern
Current Inconsistencies to Resolve
Org Context Pattern
All RLS helpers MUST use the same pattern for obtaining the current organization:current_setting('app.current_org')(CL-08 pattern — fragile, requires app-level setting)current_setting('jwt.claims.organization_id')(CL-12 pattern — JWT claim may not exist)