Generated by npm run db:docs:generate — DO NOT EDIT BY HAND. Change the schema via a migration, then regenerate.
Core: pf_ · Tables: 259 · Source generated: 2026-06-10T02:55:32.169Z
Entity relationships
Tables
pf_ai_conversations
RLS: ✅ enabled (4 policies)
Foreign keys:
organization_id→pf_organizations(id)user_id→pf_profiles(id)
Users can create own conversations(INSERT)Users can delete own conversations(DELETE)Users can update own conversations(UPDATE)Users can view own conversations(SELECT)
pf_ai_prompt_feedback
RLS: ✅ enabled (6 policies)
Foreign keys:
conversation_id→pf_ai_conversations(id)organization_id→pf_organizations(id)user_id→pf_profiles(id)
Users can create feedback(INSERT)Users can view own feedback(SELECT)pf_ai_prompt_feedback_delete(DELETE)pf_ai_prompt_feedback_insert(INSERT)pf_ai_prompt_feedback_select(SELECT)pf_ai_prompt_feedback_update(UPDATE)
pf_ai_skill_overrides
PF-62: Organization-specific customizations of system AI skills
RLS: ✅ enabled (4 policies)
Foreign keys:
created_by→pf_profiles(id)organization_id→pf_organizations(id)skill_id→pf_ai_skills(id)updated_by→pf_profiles(id)
pf_ai_skill_overrides_delete(DELETE)pf_ai_skill_overrides_insert(INSERT)pf_ai_skill_overrides_select(SELECT)pf_ai_skill_overrides_update(UPDATE)
pf_ai_skills
PF-62: AI Skills registry with system and organization-specific skills
RLS: ✅ enabled (4 policies)
Foreign keys:
created_by→pf_profiles(id)organization_id→pf_organizations(id)updated_by→pf_profiles(id)
pf_ai_skills_delete(DELETE)pf_ai_skills_insert(INSERT)pf_ai_skills_select(SELECT)pf_ai_skills_update(UPDATE)
pf_ai_usage_logs
Tracks AI usage across the platform for analytics and cost attribution
RLS: ✅ enabled (2 policies)
Foreign keys:
organization_id→pf_organizations(id)user_id→pf_profiles(id)
Users can insert own AI usage logs(INSERT)Users can view own AI usage logs(SELECT)
pf_approval_chain_templates
PF-64: Reusable approval workflow templates
RLS: ✅ enabled (4 policies)
Foreign keys:
created_by→pf_profiles(id)organization_id→pf_organizations(id)updated_by→pf_profiles(id)
pf_approval_chain_templates_delete(DELETE)pf_approval_chain_templates_insert(INSERT)pf_approval_chain_templates_select(SELECT)pf_approval_chain_templates_update(UPDATE)
pf_asam_loc_levels
CL-49/PF-70: Canonical ASAM Levels of Care reference library (platform-global).
RLS: ✅ enabled (1 policies)
Policies:
pf_asam_loc_levels_select(SELECT)
pf_assignable_roles
RLS: ✅ enabled (2 policies)
Policies:
pf_assignable_roles_admin_write(ALL)pf_assignable_roles_read(SELECT)
pf_audit_logs
SECURITY: Audit logs - INSERT only via log_audit_event() trigger function.
Direct client INSERT is intentionally blocked for audit integrity.
RLS policies: SELECT only for authorized users, no INSERT/UPDATE/DELETE policies.
Immutable by design - users cannot tamper with audit trail.
RLS: ✅ enabled (3 policies)
Foreign keys:
organization_id→pf_organizations(id)site_id→pf_sites(id)user_id→pf_profiles(id)
Org admins can view org logs(SELECT)Platform admins can view all logs(SELECT)Users can view own audit logs(SELECT)
pf_audit_logs_p202604
RLS: ✅ enabled
pf_audit_logs_p202605
RLS: ✅ enabled
pf_audit_logs_p202606
RLS: ✅ enabled
pf_audit_logs_p202607
RLS: ✅ enabled
pf_audit_logs_p202608
RLS: ✅ enabled
pf_audit_logs_p202609
RLS: ✅ enabled
pf_audit_logs_p202610
RLS: ✅ enabled
pf_audit_logs_p202611
RLS: ✅ enabled
pf_audit_logs_pdefault
Default partition for pf_audit_logs_partitioned. RLS is intentionally enabled without policies in phase-1 because dual-write sync uses SECURITY DEFINER and application read paths do not target this table until cutover; phase-2 adds final RLS policies.
RLS: ✅ enabled
pf_bulk_operation_items
PF-47: Individual item tracking within bulk operations, stores rollback snapshots.
RLS: ✅ enabled (4 policies)
Foreign keys:
created_by→pf_profiles(id)operation_id→pf_bulk_operations(id)organization_id→pf_organizations(id)updated_by→pf_profiles(id)
pf_bulk_operation_items_delete(DELETE)pf_bulk_operation_items_insert(INSERT)pf_bulk_operation_items_select(SELECT)pf_bulk_operation_items_update(UPDATE)
pf_bulk_operations
PF-47: Tracks bulk delete, update, and assign operations with progress and rollback support.
RLS: ✅ enabled (4 policies)
Foreign keys:
created_by→pf_profiles(id)organization_id→pf_organizations(id)requested_by→pf_profiles(id)updated_by→pf_profiles(id)
pf_bulk_operations_delete(DELETE)pf_bulk_operations_insert(INSERT)pf_bulk_operations_select(SELECT)pf_bulk_operations_update(UPDATE)
pf_business_processes
PF-82: Centralized registry of business processes aggregating automation rules and workflow definitions.
RLS: ✅ enabled (4 policies)
Foreign keys:
created_by→pf_profiles(id)organization_id→pf_organizations(id)updated_by→pf_profiles(id)
pf_business_processes_delete(DELETE)pf_business_processes_insert(INSERT)pf_business_processes_select(SELECT)pf_business_processes_update(UPDATE)
pf_calendar_sync_config
Calendar sync settings per organization (PF-63 Phase 3.3)
RLS: ✅ enabled (4 policies)
Foreign keys:
created_by→pf_profiles(id)organization_id→pf_organizations(id)updated_by→pf_profiles(id)
pf_calendar_sync_config_delete(DELETE)pf_calendar_sync_config_insert(INSERT)pf_calendar_sync_config_select(SELECT)pf_calendar_sync_config_update(UPDATE)
pf_chatbot_configs
PF-68: Per-organization chatbot widget configuration
RLS: ✅ enabled (4 policies)
Foreign keys:
created_by→users(id)organization_id→pf_organizations(id)updated_by→users(id)
pf_chatbot_configs_delete(DELETE)pf_chatbot_configs_insert(INSERT)pf_chatbot_configs_select(SELECT)pf_chatbot_configs_update(UPDATE)
pf_chatbot_messages
PF-68: Individual messages within chatbot sessions
RLS: ✅ enabled (2 policies)
Foreign keys:
organization_id→pf_organizations(id)session_id→pf_chatbot_sessions(id)
pf_chatbot_messages_anon_insert(INSERT)pf_chatbot_messages_select(SELECT)
pf_chatbot_sessions
PF-68: Chatbot conversation sessions for anonymous visitors
RLS: ✅ enabled (4 policies)
Foreign keys:
organization_id→pf_organizations(id)
pf_chatbot_sessions_anon_insert(INSERT)pf_chatbot_sessions_anon_update(UPDATE)pf_chatbot_sessions_select(SELECT)pf_chatbot_sessions_update(UPDATE)
pf_code_cross_mappings
RLS: ✅ enabled (4 policies)
Foreign keys:
created_by→pf_profiles(id)organization_id→pf_organizations(id)updated_by→pf_profiles(id)
pf_code_cross_mappings_delete(DELETE)pf_code_cross_mappings_insert(INSERT)pf_code_cross_mappings_select(SELECT)pf_code_cross_mappings_update(UPDATE)
pf_code_crosswalks
PF-70: Platform-managed code crosswalks (e.g. ICD-9 to ICD-10). No organization_id — platform-managed only. No app-layer writes.
RLS: ✅ enabled (1 policies)
Foreign keys:
code_set_id→pf_code_sets(id)
pf_code_crosswalks_select(SELECT)
pf_code_favorites
PF-70: Per-user favorited codes scoped to their organization.
RLS: ✅ enabled (3 policies)
Foreign keys:
organization_id→pf_organizations(id)user_id→pf_profiles(id)
pf_code_favorites_delete(DELETE)pf_code_favorites_insert(INSERT)pf_code_favorites_select(SELECT)
pf_code_modifiers
PF-70: Org-scoped modifier definitions for CPT/HCPCS codes.
RLS: ✅ enabled (4 policies)
Foreign keys:
created_by→pf_profiles(id)organization_id→pf_organizations(id)updated_by→pf_profiles(id)
pf_code_modifiers_delete(DELETE)pf_code_modifiers_insert(INSERT)pf_code_modifiers_select(SELECT)pf_code_modifiers_update(UPDATE)
pf_code_recent
PF-70: Per-user recently used codes (upsert on use; ordered by used_at DESC; limit 20 in application layer).
RLS: ✅ enabled (3 policies)
Foreign keys:
organization_id→pf_organizations(id)user_id→pf_profiles(id)
pf_code_recent_delete(DELETE)pf_code_recent_insert(INSERT)pf_code_recent_select(SELECT)
pf_code_set_versions
RLS: ✅ enabled (4 policies)
Foreign keys:
created_by→pf_profiles(id)organization_id→pf_organizations(id)updated_by→pf_profiles(id)
pf_code_set_versions_delete(DELETE)pf_code_set_versions_insert(INSERT)pf_code_set_versions_select(SELECT)pf_code_set_versions_update(UPDATE)
pf_code_sets
PF-70: Code set registry. organization_id IS NULL = platform-managed (global); non-NULL = org-customized superset.
RLS: ✅ enabled (4 policies)
Foreign keys:
created_by→pf_profiles(id)organization_id→pf_organizations(id)updated_by→pf_profiles(id)
pf_code_sets_delete(DELETE)pf_code_sets_insert(INSERT)pf_code_sets_select(SELECT)pf_code_sets_update(UPDATE)
pf_compliance_checks
PF-91: Immutable compliance check snapshots (insert-only from check worker)
RLS: ✅ enabled (2 policies)
Foreign keys:
created_by→pf_profiles(id)organization_id→pf_organizations(id)
pf_compliance_checks_insert(INSERT)pf_compliance_checks_select(SELECT)
pf_compliance_evidence
PF-91: Compliance evidence package jobs and artifacts
RLS: ✅ enabled (4 policies)
Foreign keys:
created_by→pf_profiles(id)organization_id→pf_organizations(id)updated_by→pf_profiles(id)
pf_compliance_evidence_delete(DELETE)pf_compliance_evidence_insert(INSERT)pf_compliance_evidence_select(SELECT)pf_compliance_evidence_update(UPDATE)
pf_condition_evaluation_cache
PF-32: Caches condition evaluation results for performance optimization.
RLS: ✅ enabled (4 policies)
Foreign keys:
organization_id→pf_organizations(id)
pf_condition_evaluation_cache_delete(DELETE)pf_condition_evaluation_cache_insert(INSERT)pf_condition_evaluation_cache_select(SELECT)pf_condition_evaluation_cache_update(UPDATE)
pf_condition_evaluation_metrics
PF-32: Tracks condition evaluation performance metrics.
RLS: ✅ enabled (4 policies)
Foreign keys:
organization_id→pf_organizations(id)
pf_condition_evaluation_metrics_delete(DELETE)pf_condition_evaluation_metrics_insert(INSERT)pf_condition_evaluation_metrics_select(SELECT)pf_condition_evaluation_metrics_update(UPDATE)
pf_condition_evaluation_metrics_archive
PF-32: Archived condition evaluation metrics older than retention period.
RLS: ✅ enabled (2 policies)
Foreign keys:
organization_id→pf_organizations(id)
pf_condition_evaluation_metrics_archive_delete(DELETE)pf_condition_evaluation_metrics_archive_select(SELECT)
pf_conversation_members
PF-67: Conversation membership with roles and per-user read state
RLS: ✅ enabled (4 policies)
Foreign keys:
conversation_id→pf_conversations(id)organization_id→pf_organizations(id)updated_by→pf_profiles(id)user_id→pf_profiles(id)
pf_convo_members_delete(DELETE)pf_convo_members_insert(INSERT)pf_convo_members_select(SELECT)pf_convo_members_update(UPDATE)
pf_conversations
PF-67: Conversation containers for DMs, group chats, channels, and record-anchored threads
RLS: ✅ enabled (4 policies)
Foreign keys:
created_by→pf_profiles(id)organization_id→pf_organizations(id)site_id→pf_sites(id)updated_by→pf_profiles(id)
pf_conversations_delete(DELETE)pf_conversations_insert(INSERT)pf_conversations_select(SELECT)pf_conversations_update(UPDATE)
pf_cpt_codes
PF-70: CPT procedure codes. Platform-managed; org-editable via org-scoped code_set_id.
RLS: ✅ enabled (4 policies)
Foreign keys:
code_set_id→pf_code_sets(id)
pf_cpt_codes_delete(DELETE)pf_cpt_codes_insert(INSERT)pf_cpt_codes_select(SELECT)pf_cpt_codes_update(UPDATE)
pf_credential_vault
PF-75: Metadata table linking business table credentials to vault.secrets for encrypted storage
RLS: ✅ enabled (4 policies)
Foreign keys:
created_by→users(id)organization_id→pf_organizations(id)
pf_credential_vault_delete(DELETE)pf_credential_vault_insert(INSERT)pf_credential_vault_select(SELECT)pf_credential_vault_update(UPDATE)
pf_credentials
RLS: ✅ enabled (4 policies)
Foreign keys:
created_by→pf_profiles(id)organization_id→pf_organizations(id)updated_by→pf_profiles(id)
pf_credentials_delete(DELETE)pf_credentials_insert(INSERT)pf_credentials_select(SELECT)pf_credentials_update(UPDATE)
pf_custom_field_definitions
PF-16: Defines custom fields that can be added to entity custom_fields JSONB columns
RLS: ✅ enabled (5 policies)
Foreign keys:
created_by→pf_profiles(id)organization_id→pf_organizations(id)picklist_id→pf_picklists(id)updated_by→pf_profiles(id)
custom_field_defs_org_read(SELECT)pf_custom_field_definitions_delete(DELETE)pf_custom_field_definitions_insert(INSERT)pf_custom_field_definitions_select(SELECT)pf_custom_field_definitions_update(UPDATE)
pf_custom_metric_values
PF-36 Phase 2: Stored values for custom metrics. Retention: 90 days (configurable via custom_metric_retention_days).
RLS: ✅ enabled (2 policies)
Foreign keys:
metric_id→pf_custom_metrics(id)organization_id→pf_organizations(id)
pf_custom_metric_values_insert_manual(INSERT)pf_custom_metric_values_select(SELECT)
pf_custom_metrics
PF-36 Phase 2: Organization-specific custom health metrics
RLS: ✅ enabled (4 policies)
Foreign keys:
created_by→users(id)organization_id→pf_organizations(id)updated_by→users(id)
pf_custom_metrics_delete(DELETE)pf_custom_metrics_insert(INSERT)pf_custom_metrics_select(SELECT)pf_custom_metrics_update(UPDATE)
pf_custom_object_fields
PF-24: Links custom objects to PF-16 field definitions
RLS: ✅ enabled (8 policies)
Foreign keys:
custom_object_id→pf_custom_objects(id)field_definition_id→pf_custom_field_definitions(id)organization_id→pf_organizations(id)
org_admins_delete_custom_object_fields(DELETE)org_admins_insert_custom_object_fields(INSERT)org_admins_update_custom_object_fields(UPDATE)org_members_view_custom_object_fields(SELECT)pf_custom_object_fields_delete(DELETE)pf_custom_object_fields_insert(INSERT)pf_custom_object_fields_select(SELECT)pf_custom_object_fields_update(UPDATE)
pf_custom_object_records
PF-24: Record instances storing data in JSONB format
RLS: ✅ enabled (4 policies)
Foreign keys:
created_by→pf_profiles(id)custom_object_id→pf_custom_objects(id)organization_id→pf_organizations(id)updated_by→pf_profiles(id)
org_members_delete_records(DELETE)org_members_insert_records(INSERT)org_members_select_records(SELECT)org_members_update_records(UPDATE)
pf_custom_objects
PF-24: Custom object definitions created by organization admins
RLS: ✅ enabled (4 policies)
Foreign keys:
category_id→pf_object_categories(id)created_by→pf_profiles(id)organization_id→pf_organizations(id)updated_by→pf_profiles(id)
org_admins_delete_custom_objects(DELETE)org_admins_insert_custom_objects(INSERT)org_admins_update_custom_objects(UPDATE)org_members_view_custom_objects(SELECT)
pf_custom_roles
Organization-defined custom roles with granular permissions
RLS: ✅ enabled (4 policies)
Foreign keys:
created_by→pf_profiles(id)organization_id→pf_organizations(id)updated_by→pf_profiles(id)
pf_custom_roles_delete(DELETE)pf_custom_roles_insert(INSERT)pf_custom_roles_select(SELECT)pf_custom_roles_update(UPDATE)
pf_dashboard_shares
RLS: ✅ enabled (4 policies)
Foreign keys:
organization_id→pf_organizations(id)shared_by→pf_profiles(id)shared_with_user_id→pf_profiles(id)template_id→pf_dashboard_templates(id)
pf_dashboard_shares_delete(DELETE)pf_dashboard_shares_insert(INSERT)pf_dashboard_shares_select(SELECT)pf_dashboard_shares_update(UPDATE)
pf_dashboard_templates
RLS: ✅ enabled (4 policies)
Foreign keys:
created_by→pf_profiles(id)organization_id→pf_organizations(id)updated_by→pf_profiles(id)
pf_dashboard_templates_delete(DELETE)pf_dashboard_templates_insert(INSERT)pf_dashboard_templates_select(SELECT)pf_dashboard_templates_update(UPDATE)
pf_data_lifecycle_events
PF-46: Audit trail of data lifecycle events (archival, deletion, legal hold placement/removal)
RLS: ✅ enabled (1 policies)
Foreign keys:
organization_id→pf_organizations(id)performed_by→users(id)policy_id→pf_retention_policies(id)
pf_data_lifecycle_events_select(SELECT)
pf_data_lineage
PF-18: Tracks data lineage (source→destination) for organizational entities
RLS: ✅ enabled (4 policies)
Foreign keys:
organization_id→pf_organizations(id)
pf_data_lineage_delete(DELETE)pf_data_lineage_insert(INSERT)pf_data_lineage_select(SELECT)pf_data_lineage_update(UPDATE)
pf_data_lineage_archive
PF-18: Archive of data lineage records older than 3 years (retained 7 years total)
RLS: ✅ enabled (2 policies)
Policies:
pf_data_lineage_archive_delete(DELETE)pf_data_lineage_archive_select(SELECT)
pf_data_migration_connections
PF: Per-organization external PostgreSQL connection credentials for data migration
RLS: ✅ enabled (4 policies)
Foreign keys:
created_by→users(id)organization_id→pf_organizations(id)updated_by→users(id)
pf_data_migration_connections_delete(DELETE)pf_data_migration_connections_insert(INSERT)pf_data_migration_connections_select(SELECT)pf_data_migration_connections_update(UPDATE)
pf_data_migration_mappings
PF: Stores source-to-target field mappings for external database migrations
RLS: ✅ enabled (4 policies)
Foreign keys:
created_by→pf_profiles(id)organization_id→pf_organizations(id)updated_by→pf_profiles(id)
pf_data_migration_mappings_delete(DELETE)pf_data_migration_mappings_insert(INSERT)pf_data_migration_mappings_select(SELECT)pf_data_migration_mappings_update(UPDATE)
pf_data_migration_runs
RLS: ✅ enabled (4 policies)
Foreign keys:
connection_id→pf_data_migration_connections(id)created_by→users(id)organization_id→pf_organizations(id)updated_by→users(id)
pf_data_migration_runs_delete(DELETE)pf_data_migration_runs_insert(INSERT)pf_data_migration_runs_select(SELECT)pf_data_migration_runs_update(UPDATE)
pf_data_sync_config
RLS: ✅ enabled (4 policies)
Foreign keys:
organization_id→pf_organizations(id)
pf_data_sync_config_delete(DELETE)pf_data_sync_config_insert(INSERT)pf_data_sync_config_select(SELECT)pf_data_sync_config_update(UPDATE)
pf_department_sharepoint_config
Maps departments to SharePoint groups for auto-membership (PF-63 Phase 3.2)
RLS: ✅ enabled (4 policies)
Foreign keys:
created_by→pf_profiles(id)department_id→pf_departments(id)organization_id→pf_organizations(id)updated_by→pf_profiles(id)
pf_department_sharepoint_config_delete(DELETE)pf_department_sharepoint_config_insert(INSERT)pf_department_sharepoint_config_select(SELECT)pf_department_sharepoint_config_update(UPDATE)
pf_department_teams_config
Maps departments to Microsoft Teams for auto-membership (PF-63 Phase 3.1)
RLS: ✅ enabled (4 policies)
Foreign keys:
created_by→pf_profiles(id)department_id→pf_departments(id)organization_id→pf_organizations(id)updated_by→pf_profiles(id)
pf_department_teams_config_delete(DELETE)pf_department_teams_config_insert(INSERT)pf_department_teams_config_select(SELECT)pf_department_teams_config_update(UPDATE)
pf_departments
RLS: ✅ enabled (4 policies)
Foreign keys:
created_by→pf_profiles(id)department_head_id→hr_employees(id)organization_id→pf_organizations(id)parent_department_id→pf_departments(id)site_id→pf_sites(id)updated_by→pf_profiles(id)
Org admins can delete departments(DELETE)Org admins can insert departments(INSERT)Org admins can update departments(UPDATE)Users can view departments in their organization(SELECT)
pf_document_approvals
Document approval workflow tracking
RLS: ✅ enabled (4 policies)
Foreign keys:
approver_id→pf_profiles(id)decision_by→pf_profiles(id)document_id→pf_documents(id)organization_id→pf_organizations(id)
approval_delete(DELETE)approval_insert(INSERT)approval_select(SELECT)approval_update(UPDATE)
pf_document_embeddings
Stores vector embeddings for semantic search (RAG). Uses vector (extensions.vector(1536)).
RLS: ✅ enabled (4 policies)
Foreign keys:
created_by→users(id)organization_id→pf_organizations(id)updated_by→users(id)
pf_document_embeddings_delete(DELETE)pf_document_embeddings_insert(INSERT)pf_document_embeddings_select(SELECT)pf_document_embeddings_update(UPDATE)
pf_document_expiration_log
PF-11 Phase 5: Append-only log of document expiration/archival events.
RLS: ✅ enabled (2 policies)
Foreign keys:
created_by→users(id)document_id→pf_documents(id)organization_id→pf_organizations(id)
pf_document_expiration_log_insert(INSERT)pf_document_expiration_log_select(SELECT)
pf_document_permissions
RLS: ✅ enabled (5 policies)
Foreign keys:
document_id→pf_documents(id)granted_by→pf_profiles(id)user_id→pf_profiles(id)
Users can view document permissions(SELECT)pf_document_permissions_delete(DELETE)pf_document_permissions_insert(INSERT)pf_document_permissions_select(SELECT)pf_document_permissions_update(UPDATE)
pf_document_template_versions
PF-64: Immutable version history for document templates
RLS: ✅ enabled (2 policies)
Foreign keys:
created_by→pf_profiles(id)letterhead_id→pf_letterheads(id)organization_id→pf_organizations(id)template_id→pf_document_templates(id)
pf_document_template_versions_insert(INSERT)pf_document_template_versions_select(SELECT)
pf_document_templates
PF-64: Document structure templates
RLS: ✅ enabled (4 policies)
Foreign keys:
created_by→pf_profiles(id)letterhead_id→pf_letterheads(id)organization_id→pf_organizations(id)updated_by→pf_profiles(id)
pf_document_templates_delete(DELETE)pf_document_templates_insert(INSERT)pf_document_templates_select(SELECT)pf_document_templates_update(UPDATE)
pf_document_versions
RLS: ✅ enabled (2 policies)
Foreign keys:
changed_by→pf_profiles(id)document_id→pf_documents(id)
Users can create document versions(INSERT)Users can view document versions(SELECT)
pf_documents
RLS: ✅ enabled (4 policies)
Foreign keys:
author→pf_profiles(id)organization_id→pf_organizations(id)parent_document_id→pf_documents(id)published_by→pf_profiles(id)reviewer→pf_profiles(id)site_id→pf_sites(id)
Users can create documents in their org(INSERT)Users can delete permitted documents(DELETE)Users can update permitted documents(UPDATE)Users can view permitted documents(SELECT)
pf_domain_events
RLS: ✅ enabled (1 policies)
Policies:
pf_domain_events_admin_read(SELECT)
pf_domain_events_p202604
RLS: ✅ enabled
pf_domain_events_p202605
RLS: ✅ enabled
pf_domain_events_p202606
RLS: ✅ enabled
pf_domain_events_p202607
RLS: ✅ enabled
pf_domain_events_p202608
RLS: ✅ enabled
pf_domain_events_p202609
RLS: ✅ enabled
pf_domain_events_p202610
RLS: ✅ enabled
pf_domain_events_p202611
RLS: ✅ enabled
pf_domain_events_pdefault
RLS: ✅ enabled
pf_edge_function_metrics
PF: Edge function execution metrics. System table, no RLS - written by service-role client only.
RLS: ✅ enabled
pf_email_signatures
PF-86: Organization-wide and per-user HTML/text email signatures with optional compliance disclaimers
RLS: ✅ enabled (4 policies)
Foreign keys:
created_by→pf_profiles(id)organization_id→pf_organizations(id)updated_by→pf_profiles(id)user_id→pf_profiles(id)
pf_email_signatures_delete(DELETE)pf_email_signatures_insert(INSERT)pf_email_signatures_select(SELECT)pf_email_signatures_update(UPDATE)
pf_entity_field_config_versions
PF-17: Append-only version history for entity field configurations. No UPDATE/DELETE allowed.
RLS: ✅ enabled (2 policies)
Foreign keys:
created_by→pf_profiles(id)entity_field_config_id→pf_entity_field_configs(id)organization_id→pf_organizations(id)
pf_entity_field_config_versions_insert(INSERT)pf_entity_field_config_versions_select(SELECT)
pf_entity_field_configs
PF-17: Configuration for entity field layouts, visibility, and permissions
RLS: ✅ enabled (4 policies)
Foreign keys:
created_by→pf_profiles(id)custom_field_definition_id→pf_custom_field_definitions(id)organization_id→pf_organizations(id)updated_by→pf_profiles(id)
Org admins can delete field configs(DELETE)Org admins can insert field configs(INSERT)Org admins can update field configs(UPDATE)Users can view field configs in their org(SELECT)
pf_entra_role_license_map
PF-63-EN-01: org-scoped mapping of PF-30 system role (app_role) to a Microsoft Graph license SKU id. entra-provision-user prefers this over the org default SKU.
RLS: ✅ enabled (4 policies)
Foreign keys:
organization_id→pf_organizations(id)
pf_entra_role_license_map_delete(DELETE)pf_entra_role_license_map_insert(INSERT)pf_entra_role_license_map_select(SELECT)pf_entra_role_license_map_update(UPDATE)
pf_export_files
Tracks generated export files and downloads (PF-44)
RLS: ✅ enabled (2 policies)
Foreign keys:
created_by→pf_profiles(id)export_request_id→pf_export_requests(id)organization_id→pf_organizations(id)
pf_export_files_insert(INSERT)pf_export_files_select(SELECT)
pf_export_requests
Data export requests with status tracking (PF-44)
RLS: ✅ enabled (4 policies)
Foreign keys:
organization_id→pf_organizations(id)requested_by→pf_profiles(id)template_id→pf_export_templates(id)
pf_export_requests_delete(DELETE)pf_export_requests_insert(INSERT)pf_export_requests_select(SELECT)pf_export_requests_update(UPDATE)
pf_export_templates
Reusable export configurations for data export compliance (PF-44)
RLS: ✅ enabled (4 policies)
Foreign keys:
created_by→pf_profiles(id)organization_id→pf_organizations(id)updated_by→pf_profiles(id)
pf_export_templates_delete(DELETE)pf_export_templates_insert(INSERT)pf_export_templates_select(SELECT)pf_export_templates_update(UPDATE)
pf_feature_flag_usage
RLS: ✅ enabled (2 policies)
Foreign keys:
flag_id→pf_feature_flags(id)organization_id→pf_organizations(id)user_id→users(id)
pf_ff_usage_insert_locked(INSERT)pf_ff_usage_select(SELECT)
pf_feature_flags
PF-45: Feature flag definitions with support for boolean, percentage rollout, and A/B test types.
RLS: ✅ enabled (4 policies)
Foreign keys:
created_by→users(id)organization_id→pf_organizations(id)updated_by→users(id)user_id→users(id)
pf_feature_flags_delete(DELETE)pf_feature_flags_insert(INSERT)pf_feature_flags_select(SELECT)pf_feature_flags_update(UPDATE)
pf_field_interaction_stats
PF-09: Aggregated field-level interaction statistics
RLS: ✅ enabled (6 policies)
Foreign keys:
form_id→fw_forms(id)organization_id→pf_organizations(id)
field_stats_insert(INSERT)field_stats_select(SELECT)field_stats_update(UPDATE)pf_field_interaction_stats_insert(INSERT)pf_field_interaction_stats_select(SELECT)pf_field_interaction_stats_update(UPDATE)
pf_field_permissions
RLS: ✅ enabled (4 policies)
Foreign keys:
organization_id→pf_organizations(id)
pf_field_permissions_delete(DELETE)pf_field_permissions_insert(INSERT)pf_field_permissions_select(SELECT)pf_field_permissions_update(UPDATE)
pf_form_analytics_events
PF-09: Raw form analytics events for tracking user interactions
RLS: ✅ enabled (2 policies)
Foreign keys:
form_id→fw_forms(id)organization_id→pf_organizations(id)site_id→pf_sites(id)submission_id→fw_form_submissions(id)user_id→pf_profiles(id)
analytics_events_insert(INSERT)analytics_events_select(SELECT)
pf_form_completion_metrics
PF-09: Aggregated form completion metrics per time period
RLS: ✅ enabled (3 policies)
Foreign keys:
form_id→fw_forms(id)organization_id→pf_organizations(id)site_id→pf_sites(id)
completion_metrics_insert(INSERT)completion_metrics_select(SELECT)completion_metrics_update(UPDATE)
pf_gesture_analytics_events
PF-37 Phase 2: Tracks gesture usage analytics for product insights. Events retained for 90 days. Append-only; no UPDATE/DELETE by users. pf_profiles.id = auth.uid() by design.
RLS: ✅ enabled (2 policies)
Foreign keys:
organization_id→pf_organizations(id)user_id→pf_profiles(id)
pf_gesture_analytics_events_insert(INSERT)pf_gesture_analytics_events_select(SELECT)
pf_github_webhook_events
GitHub webhook delivery IDs for idempotency; used by github-webhook edge function
RLS: ✅ enabled
pf_google_workspace_connections
PF-101: One Google Workspace connection per organization. Stores connection status, BAA attestation (PHI gate), and capability flags. Raw OAuth credentials live in PF-76 Credential Vault, referenced by credential_vault_ref.
RLS: ✅ enabled (4 policies)
Foreign keys:
baa_attested_by→users(id)created_by→users(id)oauth_initiated_by→users(id)organization_id→pf_organizations(id)updated_by→users(id)
pf_gws_connections_delete(DELETE)pf_gws_connections_insert(INSERT)pf_gws_connections_select(SELECT)pf_gws_connections_update(UPDATE)
pf_google_workspace_mappings
PF-101: Generic mapping store for Google Workspace integration (sites→OUs, roles→groups, departments→groups, license assignments).
RLS: ✅ enabled (4 policies)
Foreign keys:
connection_id→pf_google_workspace_connections(id)created_by→users(id)organization_id→pf_organizations(id)updated_by→users(id)
pf_gws_mappings_delete(DELETE)pf_gws_mappings_insert(INSERT)pf_gws_mappings_select(SELECT)pf_gws_mappings_update(UPDATE)
pf_google_workspace_sync_runs
PF-101: Audit log of every Google Workspace sync/provisioning run. Append-only operationally; do not log PHI in summary or error_detail.
RLS: ✅ enabled (1 policies)
Foreign keys:
connection_id→pf_google_workspace_connections(id)organization_id→pf_organizations(id)triggered_by→users(id)
pf_gws_sync_runs_select(SELECT)
pf_google_workspace_user_links
PF-101: Maps platform users (auth.users) and optional HR employees to Google Workspace accounts. Tracks provisioning lifecycle.
RLS: ✅ enabled (4 policies)
Foreign keys:
connection_id→pf_google_workspace_connections(id)created_by→users(id)organization_id→pf_organizations(id)updated_by→users(id)user_id→users(id)
pf_gws_user_links_delete(DELETE)pf_gws_user_links_insert(INSERT)pf_gws_user_links_select(SELECT)pf_gws_user_links_update(UPDATE)
pf_hcpcs_codes
PF-70: HCPCS Level II codes. Platform-managed; org-editable via org-scoped code_set_id.
RLS: ✅ enabled (4 policies)
Foreign keys:
code_set_id→pf_code_sets(id)
pf_hcpcs_codes_delete(DELETE)pf_hcpcs_codes_insert(INSERT)pf_hcpcs_codes_select(SELECT)pf_hcpcs_codes_update(UPDATE)
pf_headshot_campaign_members
RLS: ✅ enabled (3 policies)
Foreign keys:
campaign_id→pf_headshot_campaigns(id)job_id→pf_headshot_jobs(id)organization_id→pf_organizations(id)user_id→pf_profiles(id)
pf_headshot_campaign_members_all_admin(ALL)pf_headshot_campaign_members_select_own(SELECT)pf_headshot_campaign_members_update_own(UPDATE)
pf_headshot_campaigns
RLS: ✅ enabled (2 policies)
Foreign keys:
created_by→pf_profiles(id)organization_id→pf_organizations(id)updated_by→pf_profiles(id)
pf_headshot_campaigns_all_admin(ALL)pf_headshot_campaigns_select_member(SELECT)
pf_headshot_jobs
RLS: ✅ enabled (4 policies)
Foreign keys:
campaign_id→pf_headshot_campaigns(id)created_by→pf_profiles(id)organization_id→pf_organizations(id)updated_by→pf_profiles(id)user_id→pf_profiles(id)
pf_headshot_jobs_insert(INSERT)pf_headshot_jobs_select_admin(SELECT)pf_headshot_jobs_select_own(SELECT)pf_headshot_jobs_update(UPDATE)
pf_headshot_results
RLS: ✅ enabled (3 policies)
Foreign keys:
created_by→pf_profiles(id)job_id→pf_headshot_jobs(id)organization_id→pf_organizations(id)updated_by→pf_profiles(id)user_id→pf_profiles(id)
pf_headshot_results_insert(INSERT)pf_headshot_results_select_own(SELECT)pf_headshot_results_update(UPDATE)
pf_headshot_uploads
RLS: ✅ enabled (4 policies)
Foreign keys:
created_by→pf_profiles(id)job_id→pf_headshot_jobs(id)organization_id→pf_organizations(id)user_id→pf_profiles(id)
pf_headshot_uploads_insert(INSERT)pf_headshot_uploads_select_admin(SELECT)pf_headshot_uploads_select_own(SELECT)pf_headshot_uploads_update(UPDATE)
pf_health_alert_configs
RLS: ✅ enabled (8 policies)
Foreign keys:
created_by→pf_profiles(id)organization_id→pf_organizations(id)slack_webhook_vault_id→pf_credential_vault(id)updated_by→pf_profiles(id)
pf_health_alert_configs_delete(DELETE)pf_health_alert_configs_insert(INSERT)pf_health_alert_configs_org_admin_delete(DELETE)pf_health_alert_configs_org_admin_insert(INSERT)pf_health_alert_configs_org_admin_select(SELECT)pf_health_alert_configs_org_admin_update(UPDATE)pf_health_alert_configs_select(SELECT)pf_health_alert_configs_update(UPDATE)
pf_health_alert_history
RLS: ✅ enabled (6 policies)
Foreign keys:
acknowledged_by→pf_profiles(id)alert_config_id→pf_health_alert_configs(id)organization_id→pf_organizations(id)resolved_by→pf_profiles(id)
pf_health_alert_history_delete(DELETE)pf_health_alert_history_insert(INSERT)pf_health_alert_history_org_admin_select(SELECT)pf_health_alert_history_org_admin_update(UPDATE)pf_health_alert_history_select(SELECT)pf_health_alert_history_update(UPDATE)
pf_health_metrics
RLS: ✅ enabled (10 policies)
Foreign keys:
organization_id→pf_organizations(id)
pf_health_metrics_anon_deny_delete(DELETE)pf_health_metrics_anon_deny_insert(INSERT)pf_health_metrics_anon_deny_select(SELECT)pf_health_metrics_anon_deny_update(UPDATE)pf_health_metrics_insert(INSERT)pf_health_metrics_platform_admin_delete(DELETE)pf_health_metrics_platform_admin_insert(INSERT)pf_health_metrics_platform_admin_select(SELECT)pf_health_metrics_platform_admin_update(UPDATE)pf_health_metrics_select(SELECT)
pf_icd10_codes
PF-70: ICD-10-CM diagnosis codes. Loaded via migration by platform team; org-editable via code_set_id.
RLS: ✅ enabled (4 policies)
Foreign keys:
code_set_id→pf_code_sets(id)
pf_icd10_codes_delete(DELETE)pf_icd10_codes_insert(INSERT)pf_icd10_codes_select(SELECT)pf_icd10_codes_update(UPDATE)
pf_idempotency_keys
RLS: ✅ enabled (2 policies)
Foreign keys:
organization_id→pf_organizations(id)
pf_idempotency_keys_insert(INSERT)pf_idempotency_keys_select(SELECT)
pf_import_batches
PF-88: Tracks bulk import batches for Data import hub. Stores batch metadata, field mappings, validation errors, and lifecycle status.
RLS: ✅ enabled (4 policies)
Foreign keys:
created_by→pf_profiles(id)organization_id→pf_organizations(id)updated_by→pf_profiles(id)
pf_import_batches_delete(DELETE)pf_import_batches_insert(INSERT)pf_import_batches_select(SELECT)pf_import_batches_update(UPDATE)
pf_import_mapping_templates
PF-88: Reusable field mapping templates for import batches.
RLS: ✅ enabled (4 policies)
Foreign keys:
created_by→pf_profiles(id)organization_id→pf_organizations(id)updated_by→pf_profiles(id)
pf_import_mapping_templates_delete(DELETE)pf_import_mapping_templates_insert(INSERT)pf_import_mapping_templates_select(SELECT)pf_import_mapping_templates_update(UPDATE)
pf_import_records
PF-88: Individual row records within an import batch. Tracks per-row status, mapping, and errors.
RLS: ✅ enabled (3 policies)
Foreign keys:
batch_id→pf_import_batches(id)created_by→pf_profiles(id)organization_id→pf_organizations(id)updated_by→pf_profiles(id)
pf_import_records_insert(INSERT)pf_import_records_select(SELECT)pf_import_records_update(UPDATE)
pf_inbox_snoozes
PF Unified Inbox: snooze until time per item (item_key e.g. task-123, notif-456)
RLS: ✅ enabled (4 policies)
Foreign keys:
created_by→users(id)organization_id→pf_organizations(id)updated_by→users(id)user_id→users(id)
pf_inbox_snoozes_delete(DELETE)pf_inbox_snoozes_insert(INSERT)pf_inbox_snoozes_select(SELECT)pf_inbox_snoozes_update(UPDATE)
pf_integration_credentials
RLS: ✅ enabled (4 policies)
Foreign keys:
integration_id→pf_integrations(id)
pf_integration_credentials_deny_delete(DELETE)pf_integration_credentials_deny_insert(INSERT)pf_integration_credentials_deny_select(SELECT)pf_integration_credentials_deny_update(UPDATE)
pf_integrations
RLS: ✅ enabled (4 policies)
Foreign keys:
created_by→pf_profiles(id)organization_id→pf_organizations(id)updated_by→pf_profiles(id)
pf_integrations_delete(DELETE)pf_integrations_insert(INSERT)pf_integrations_select(SELECT)pf_integrations_update(UPDATE)
pf_ip_allowlist
RLS: ✅ enabled (9 policies)
Foreign keys:
created_by→pf_profiles(id)organization_id→pf_organizations(id)updated_by→pf_profiles(id)
pf_ip_allowlist_delete(DELETE)pf_ip_allowlist_insert(INSERT)pf_ip_allowlist_org_admin_delete(DELETE)pf_ip_allowlist_org_admin_insert(INSERT)pf_ip_allowlist_org_admin_select(SELECT)pf_ip_allowlist_org_admin_update(UPDATE)pf_ip_allowlist_platform_admin_all(ALL)pf_ip_allowlist_select(SELECT)pf_ip_allowlist_update(UPDATE)
pf_ip_blocklist
RLS: ✅ enabled (9 policies)
Foreign keys:
created_by→pf_profiles(id)organization_id→pf_organizations(id)updated_by→pf_profiles(id)
pf_ip_blocklist_delete(DELETE)pf_ip_blocklist_insert(INSERT)pf_ip_blocklist_org_admin_delete(DELETE)pf_ip_blocklist_org_admin_insert(INSERT)pf_ip_blocklist_org_admin_select(SELECT)pf_ip_blocklist_org_admin_update(UPDATE)pf_ip_blocklist_platform_admin_all(ALL)pf_ip_blocklist_select(SELECT)pf_ip_blocklist_update(UPDATE)
pf_jurisdiction_profiles
PF-96: State Medicaid compliance profiles with clinical, billing, and compliance rule packs.
RLS: ✅ enabled (2 policies)
Foreign keys:
created_by→pf_profiles(id)updated_by→pf_profiles(id)
pf_jurisdiction_profiles_all_admin(ALL)pf_jurisdiction_profiles_select_active(SELECT)
pf_knowledge_base
PF-61: Curated knowledge articles for AI training and RAG
RLS: ✅ enabled (4 policies)
Foreign keys:
created_by→users(id)organization_id→pf_organizations(id)published_by→users(id)source_document_id→pf_documents(id)updated_by→users(id)
pf_knowledge_base_delete(DELETE)pf_knowledge_base_insert(INSERT)pf_knowledge_base_select(SELECT)pf_knowledge_base_update(UPDATE)
pf_legal_holds
PF-46: Legal holds that prevent data from being archived or deleted regardless of retention policies
RLS: ✅ enabled (4 policies)
Foreign keys:
created_by→users(id)organization_id→pf_organizations(id)updated_by→users(id)
pf_legal_holds_delete(DELETE)pf_legal_holds_insert(INSERT)pf_legal_holds_select(SELECT)pf_legal_holds_update(UPDATE)
pf_letterheads
PF-64: Organization letterhead configurations
RLS: ✅ enabled (4 policies)
Foreign keys:
created_by→pf_profiles(id)organization_id→pf_organizations(id)updated_by→pf_profiles(id)
pf_letterheads_delete(DELETE)pf_letterheads_insert(INSERT)pf_letterheads_select(SELECT)pf_letterheads_update(UPDATE)
pf_locus_loc_levels
CL-49/PF-70: Canonical LOCUS Levels of Care reference library (platform-global).
RLS: ✅ enabled (1 policies)
Policies:
pf_locus_loc_levels_select(SELECT)
pf_marketplace_ratings
RLS: ✅ enabled (4 policies)
Foreign keys:
created_by→pf_profiles(id)listing_id→pf_wizard_marketplace_listings(id)organization_id→pf_organizations(id)updated_by→pf_profiles(id)user_id→pf_profiles(id)
pf_marketplace_ratings_delete(DELETE)pf_marketplace_ratings_insert(INSERT)pf_marketplace_ratings_select(SELECT)pf_marketplace_ratings_update(UPDATE)
pf_message_bookmarks
PF-67: User-saved message bookmarks for quick reference
RLS: ✅ enabled (3 policies)
Foreign keys:
conversation_id→pf_conversations(id)message_id→pf_messages(id)organization_id→pf_organizations(id)user_id→users(id)
pf_message_bookmarks_delete(DELETE)pf_message_bookmarks_insert(INSERT)pf_message_bookmarks_select(SELECT)
pf_message_read_receipts
PF-67: Per-user read tracking (append-only — no UPDATE or DELETE)
RLS: ✅ enabled (4 policies)
Foreign keys:
message_id→pf_messages(id)organization_id→pf_organizations(id)user_id→pf_profiles(id)
pf_read_receipts_delete(DELETE)pf_read_receipts_insert(INSERT)pf_read_receipts_select(SELECT)pf_read_receipts_update(UPDATE)
pf_messages
PF-67: Individual messages. sender_id serves as created_by per spec deviation.
RLS: ✅ enabled (4 policies)
Foreign keys:
conversation_id→pf_conversations(id)deleted_by→pf_profiles(id)organization_id→pf_organizations(id)parent_message_id→pf_messages(id)pinned_by→pf_profiles(id)sender_id→pf_profiles(id)updated_by→pf_profiles(id)
pf_messages_delete(DELETE)pf_messages_insert(INSERT)pf_messages_select(SELECT)pf_messages_update(UPDATE)
pf_module_permissions
System-wide catalog of all available module permissions
RLS: ✅ enabled (4 policies)
Policies:
pf_module_permissions_delete(DELETE)pf_module_permissions_insert(INSERT)pf_module_permissions_select(SELECT)pf_module_permissions_update(UPDATE)
pf_module_presets
RLS: ✅ enabled (5 policies)
Foreign keys:
created_by→users(id)organization_id→pf_organizations(id)site_id→pf_sites(id)updated_by→users(id)
pf_module_presets_delete(DELETE)pf_module_presets_insert(INSERT)pf_module_presets_select_org(SELECT)pf_module_presets_select_system(SELECT)pf_module_presets_update(UPDATE)
pf_module_settings
Organization-level platform configuration settings
RLS: ✅ enabled (4 policies)
Foreign keys:
created_by→pf_profiles(id)default_letterhead_id→pf_letterheads(id)organization_id→pf_organizations(id)updated_by→pf_profiles(id)
pf_module_settings_delete(DELETE)pf_module_settings_insert(INSERT)pf_module_settings_select(SELECT)pf_module_settings_update(UPDATE)
pf_notification_batches
Notification batches for digest emails. Managed exclusively via service role (edge functions).
INSERT/UPDATE/DELETE policies are intentionally omitted as only edge functions with service_role access manage this table.
SELECT policy exists to allow authenticated users to view their own batch status.
RLS: ✅ enabled (1 policies)
Foreign keys:
organization_id→pf_organizations(id)user_id→pf_profiles(id)
pf_notification_batches_select_own(SELECT)
pf_notification_delivery_log
PF-10: Tracks all notification delivery attempts for audit and retry
RLS: ✅ enabled (2 policies)
Foreign keys:
notification_id→pf_notifications(id)
pf_notification_delivery_log_select(SELECT)pf_notification_delivery_log_system_insert(INSERT)
pf_notification_preferences
User notification preferences per type and channel. Controls quiet hours, batching, and opt-outs.
RLS: ✅ enabled (4 policies)
Foreign keys:
user_id→pf_profiles(id)
Users can delete own preferences(DELETE)Users can manage own preferences(INSERT)Users can update own preferences(UPDATE)Users can view own preferences(SELECT)
pf_notification_template_variables
Supported template variables with metadata for validation and preview. System variables (is_system=true) are platform-defined.
RLS: ✅ enabled (4 policies)
Foreign keys:
created_by→pf_profiles(id)organization_id→pf_organizations(id)updated_by→pf_profiles(id)
pf_ntv_delete(DELETE)pf_ntv_insert(INSERT)pf_ntv_select(SELECT)pf_ntv_update(UPDATE)
pf_notification_templates
Notification templates with variable substitution support. Platform-wide templates have NULL organization_id.
RLS: ✅ enabled (9 policies)
Foreign keys:
created_by→pf_profiles(id)organization_id→pf_organizations(id)updated_by→users(id)
Users can view org templates(SELECT)pf_notification_templates_org_admin_delete(DELETE)pf_notification_templates_org_admin_insert(INSERT)pf_notification_templates_org_admin_select(SELECT)pf_notification_templates_org_admin_update(UPDATE)pf_notification_templates_platform_admin_delete(DELETE)pf_notification_templates_platform_admin_insert(INSERT)pf_notification_templates_platform_admin_select(SELECT)pf_notification_templates_platform_admin_update(UPDATE)
pf_notifications
Multi-channel notification delivery tracking. Use send_notification() function to create notifications.
RLS: ✅ enabled (5 policies)
Foreign keys:
batch_id→pf_notification_batches(id)organization_id→pf_organizations(id)site_id→pf_sites(id)template_id→pf_notification_templates(id)user_id→pf_profiles(id)
Org admins can insert notifications(INSERT)Org admins can view org notifications(SELECT)Platform admins can view all notifications(SELECT)Users can update own in-app notifications(UPDATE)Users can view own notifications(SELECT)
pf_oauth_providers
RLS: ✅ enabled (4 policies)
Foreign keys:
created_by→pf_profiles(id)organization_id→pf_organizations(id)updated_by→pf_profiles(id)
pf_oauth_providers_delete(DELETE)pf_oauth_providers_insert(INSERT)pf_oauth_providers_select(SELECT)pf_oauth_providers_update(UPDATE)
pf_oauth_state
Temporary storage for OAuth state data. Auto-expires after 10 minutes. Uses consumed_at to track single-use state tokens.
RLS: ✅ enabled (9 policies)
Policies:
pf_oauth_state_deny_anon_delete(DELETE)pf_oauth_state_deny_anon_insert(INSERT)pf_oauth_state_deny_anon_select(SELECT)pf_oauth_state_deny_anon_update(UPDATE)pf_oauth_state_deny_auth_delete(DELETE)pf_oauth_state_deny_auth_insert(INSERT)pf_oauth_state_deny_auth_select(SELECT)pf_oauth_state_deny_auth_update(UPDATE)pf_oauth_state_service_only(ALL)
pf_oauth_tokens
RLS: ✅ enabled (4 policies)
Foreign keys:
created_by→pf_profiles(id)integration_id→pf_integrations(id)organization_id→pf_organizations(id)provider_id→pf_oauth_providers(id)updated_by→pf_profiles(id)
pf_oauth_tokens_delete(DELETE)pf_oauth_tokens_insert(INSERT)pf_oauth_tokens_select(SELECT)pf_oauth_tokens_update(UPDATE)
pf_object_categories
RLS: ✅ enabled (4 policies)
Foreign keys:
created_by→pf_profiles(id)organization_id→pf_organizations(id)updated_by→pf_profiles(id)
pf_object_categories_delete(DELETE)pf_object_categories_insert(INSERT)pf_object_categories_select(SELECT)pf_object_categories_update(UPDATE)
pf_object_favorites
RLS: ✅ enabled (3 policies)
Foreign keys:
created_by→pf_profiles(id)object_metadata_id→pf_object_metadata(id)organization_id→pf_organizations(id)user_id→pf_profiles(id)
pf_object_favorites_delete(DELETE)pf_object_favorites_insert(INSERT)pf_object_favorites_select(SELECT)
pf_object_metadata
RLS: ✅ enabled (4 policies)
Foreign keys:
category_id→pf_object_categories(id)created_by→pf_profiles(id)organization_id→pf_organizations(id)updated_by→pf_profiles(id)
pf_object_metadata_delete(DELETE)pf_object_metadata_insert(INSERT)pf_object_metadata_select(SELECT)pf_object_metadata_update(UPDATE)
pf_object_permissions
RLS: ✅ enabled (4 policies)
Foreign keys:
created_by→pf_profiles(id)organization_id→pf_organizations(id)updated_by→pf_profiles(id)
pf_object_permissions_delete(DELETE)pf_object_permissions_insert(INSERT)pf_object_permissions_select(SELECT)pf_object_permissions_update(UPDATE)
pf_onboarding_sessions
PF-88: Multi-step onboarding wizard sessions with resume capability.
RLS: ✅ enabled (4 policies)
Foreign keys:
created_by→pf_profiles(id)organization_id→pf_organizations(id)updated_by→pf_profiles(id)
pf_onboarding_sessions_delete(DELETE)pf_onboarding_sessions_insert(INSERT)pf_onboarding_sessions_select(SELECT)pf_onboarding_sessions_update(UPDATE)
pf_onboarding_step_batches
PF-88: Junction linking onboarding wizard steps to import batches.
RLS: ✅ enabled (2 policies)
Foreign keys:
batch_id→pf_import_batches(id)organization_id→pf_organizations(id)session_id→pf_onboarding_sessions(id)
pf_onboarding_step_batches_insert(INSERT)pf_onboarding_step_batches_select(SELECT)
pf_org_api_keys
PF-97: API key credentials bound to service accounts — stores only the hash, never the raw key
RLS: ✅ enabled (4 policies)
Foreign keys:
created_by→pf_profiles(id)organization_id→pf_organizations(id)replaced_by→pf_org_api_keys(id)revoked_by→pf_profiles(id)service_account_id→pf_service_accounts(id)updated_by→pf_profiles(id)
pf_org_api_keys_delete(DELETE)pf_org_api_keys_insert(INSERT)pf_org_api_keys_select(SELECT)pf_org_api_keys_update(UPDATE)
pf_org_dashboard_defaults
Organization-level dashboard default configurations for widgets and quick actions
RLS: ✅ enabled (4 policies)
Foreign keys:
created_by→pf_profiles(id)organization_id→pf_organizations(id)template_id→pf_dashboard_templates(id)updated_by→pf_profiles(id)
pf_org_dashboard_defaults_delete(DELETE)pf_org_dashboard_defaults_insert(INSERT)pf_org_dashboard_defaults_select(SELECT)pf_org_dashboard_defaults_update(UPDATE)
pf_org_data_sync_events
PF-18: Stores organizational data change events for cross-module synchronization
RLS: ✅ enabled (6 policies)
Foreign keys:
created_by→pf_profiles(id)organization_id→pf_organizations(id)
Admins can insert sync events(INSERT)Admins can update sync events(UPDATE)pf_org_sync_events_delete(DELETE)pf_org_sync_events_insert(INSERT)pf_org_sync_events_select(SELECT)pf_org_sync_events_update(UPDATE)
pf_org_hierarchies
PF-18: Advanced organizational hierarchy relationships (Phase 4 consumer)
RLS: ✅ enabled (4 policies)
Foreign keys:
created_by→pf_profiles(id)organization_id→pf_organizations(id)
pf_org_hierarchies_delete(DELETE)pf_org_hierarchies_insert(INSERT)pf_org_hierarchies_select(SELECT)pf_org_hierarchies_update(UPDATE)
pf_org_jurisdiction_config
PF-96: Organization jurisdiction profile assignment with optional overrides. One row per org.
RLS: ✅ enabled (4 policies)
Foreign keys:
created_by→pf_profiles(id)jurisdiction_profile_id→pf_jurisdiction_profiles(id)organization_id→pf_organizations(id)updated_by→pf_profiles(id)
pf_org_jurisdiction_config_delete(DELETE)pf_org_jurisdiction_config_insert(INSERT)pf_org_jurisdiction_config_select(SELECT)pf_org_jurisdiction_config_update(UPDATE)
pf_org_quick_action_selections
RLS: ✅ enabled (4 policies)
Foreign keys:
organization_id→pf_organizations(id)
pf_org_quick_action_selections_delete(DELETE)pf_org_quick_action_selections_insert(INSERT)pf_org_quick_action_selections_select(SELECT)pf_org_quick_action_selections_update(UPDATE)
pf_org_sso_providers
PF-112: per-org Supabase SAML SSO provider registry for BYO-tenant Entra federation.
RLS: ✅ enabled (4 policies)
Foreign keys:
organization_id→pf_organizations(id)
pf_org_sso_providers_delete(DELETE)pf_org_sso_providers_insert(INSERT)pf_org_sso_providers_select(SELECT)pf_org_sso_providers_update(UPDATE)
pf_organizations
RLS: ✅ enabled (6 policies)
Policies:
Org admins can update their organization(UPDATE)Users with org access can view(SELECT)pf_organizations_platform_admin_delete(DELETE)pf_organizations_platform_admin_insert(INSERT)pf_organizations_platform_admin_select(SELECT)pf_organizations_platform_admin_update(UPDATE)
pf_outbound_webhooks
RLS: ✅ enabled (4 policies)
Foreign keys:
created_by→pf_profiles(id)integration_id→pf_integrations(id)organization_id→pf_organizations(id)updated_by→pf_profiles(id)
pf_outbound_webhooks_delete(DELETE)pf_outbound_webhooks_insert(INSERT)pf_outbound_webhooks_select(SELECT)pf_outbound_webhooks_update(UPDATE)
pf_page_layout_fields
Field assignments within layout sections
RLS: ✅ enabled (4 policies)
Foreign keys:
section_id→pf_page_layout_sections(id)
pf_page_layout_fields_delete(DELETE)pf_page_layout_fields_insert(INSERT)pf_page_layout_fields_select(SELECT)pf_page_layout_fields_update(UPDATE)
pf_page_layout_sections
Sections within page layouts for grouping related fields
RLS: ✅ enabled (4 policies)
Foreign keys:
layout_id→pf_page_layouts(id)
pf_page_layout_sections_delete(DELETE)pf_page_layout_sections_insert(INSERT)pf_page_layout_sections_select(SELECT)pf_page_layout_sections_update(UPDATE)
pf_page_layout_templates
PF-31 Phase 3: Reusable layout templates. NULL organization_id = platform-wide template.
RLS: ✅ enabled (4 policies)
Foreign keys:
created_by→pf_profiles(id)organization_id→pf_organizations(id)updated_by→pf_profiles(id)
pf_page_layout_templates_delete(DELETE)pf_page_layout_templates_insert(INSERT)pf_page_layout_templates_select(SELECT)pf_page_layout_templates_update(UPDATE)
pf_page_layout_versions
PF-31: Append-only version history for page layouts; restore replaces current layout from snapshot.
RLS: ✅ enabled (4 policies)
Foreign keys:
created_by→pf_profiles(id)layout_id→pf_page_layouts(id)organization_id→pf_organizations(id)
pf_page_layout_versions_delete(DELETE)pf_page_layout_versions_insert(INSERT)pf_page_layout_versions_select(SELECT)pf_page_layout_versions_update(UPDATE)
pf_page_layout_visibility_rules
PF-31: Conditional visibility rules for layout fields; evaluated at render time.
RLS: ✅ enabled (4 policies)
Foreign keys:
created_by→pf_profiles(id)layout_id→pf_page_layouts(id)organization_id→pf_organizations(id)section_id→pf_page_layout_sections(id)updated_by→pf_profiles(id)
pf_page_layout_visibility_rules_delete(DELETE)pf_page_layout_visibility_rules_insert(INSERT)pf_page_layout_visibility_rules_select(SELECT)pf_page_layout_visibility_rules_update(UPDATE)
pf_page_layout_wizards
PF-31 Phase 3: Multi-step wizard definitions for guided record creation
RLS: ✅ enabled (4 policies)
Foreign keys:
created_by→pf_profiles(id)organization_id→pf_organizations(id)updated_by→pf_profiles(id)
pf_page_layout_wizards_delete(DELETE)pf_page_layout_wizards_insert(INSERT)pf_page_layout_wizards_select(SELECT)pf_page_layout_wizards_update(UPDATE)
pf_page_layouts
Page layout definitions for record detail/edit/create views
RLS: ✅ enabled (4 policies)
Foreign keys:
created_by→pf_profiles(id)organization_id→pf_organizations(id)updated_by→pf_profiles(id)
pf_page_layouts_delete(DELETE)pf_page_layouts_insert(INSERT)pf_page_layouts_select(SELECT)pf_page_layouts_update(UPDATE)
pf_patient_identities
PF: Central patient identity registry. MRN is unique per organization. Referenced by CL and PM cores.
RLS: ✅ enabled (4 policies)
Foreign keys:
created_by→pf_profiles(id)organization_id→pf_organizations(id)updated_by→pf_profiles(id)
pf_patient_identities_delete(DELETE)pf_patient_identities_insert(INSERT)pf_patient_identities_select(SELECT)pf_patient_identities_update(UPDATE)
pf_payer_code_rules
PF-70: Org-scoped payer code rules (prior auth, denied codes, modifier requirements). payer_id is a bare UUID — no FK to pm_payers per C-3 architecture decision.
RLS: ✅ enabled (4 policies)
Foreign keys:
created_by→pf_profiles(id)organization_id→pf_organizations(id)updated_by→pf_profiles(id)
pf_payer_code_rules_delete(DELETE)pf_payer_code_rules_insert(INSERT)pf_payer_code_rules_select(SELECT)pf_payer_code_rules_update(UPDATE)
pf_phi_classifications
PF-91: PHI/PII/SUD column-level classification for compliance monitoring
RLS: ✅ enabled (4 policies)
Foreign keys:
created_by→pf_profiles(id)organization_id→pf_organizations(id)updated_by→pf_profiles(id)verified_by→pf_profiles(id)
pf_phi_classifications_delete(DELETE)pf_phi_classifications_insert(INSERT)pf_phi_classifications_select(SELECT)pf_phi_classifications_update(UPDATE)
pf_picklist_default_definitions
PF-15: Platform-wide picklist definitions. Seeds new organizations via pf_seed_picklists_for_new_organization() and is the source of truth for pf_backfill_picklist_defaults_for_all_orgs(). System/config table — no organization_id.
RLS: ✅ enabled (4 policies)
Policies:
pf_picklist_default_definitions_delete(DELETE)pf_picklist_default_definitions_insert(INSERT)pf_picklist_default_definitions_select(SELECT)pf_picklist_default_definitions_update(UPDATE)
pf_picklist_default_items
PF-15: Items for each pf_picklist_default_definitions row. Copied per-org into pf_picklist_items by the seed/backfill helpers.
RLS: ✅ enabled (4 policies)
Foreign keys:
definition_id→pf_picklist_default_definitions(id)
pf_picklist_default_items_delete(DELETE)pf_picklist_default_items_insert(INSERT)pf_picklist_default_items_select(SELECT)pf_picklist_default_items_update(UPDATE)
pf_picklist_items
PF-15: Individual items/values within a picklist
RLS: ✅ enabled (4 policies)
Foreign keys:
picklist_id→pf_picklists(id)
pf_picklist_items_delete(DELETE)pf_picklist_items_insert(INSERT)pf_picklist_items_select(SELECT)pf_picklist_items_update(UPDATE)
pf_picklists
PF-15: Organization-scoped picklist definitions for customizable dropdown values
RLS: ✅ enabled (4 policies)
Foreign keys:
created_by→pf_profiles(id)organization_id→pf_organizations(id)updated_by→pf_profiles(id)
pf_picklists_delete(DELETE)pf_picklists_insert(INSERT)pf_picklists_select(SELECT)pf_picklists_update(UPDATE)
pf_portal_credentials
PF-119: maps a flow to its bot-identity credential HANDLE in pf_credential_vault (PF-75/76). Stores no secret material; read restricted to org_admin.
RLS: ✅ enabled (4 policies)
Foreign keys:
credential_vault_id→pf_credential_vault(id)flow_id→pf_portal_flows(id)organization_id→pf_organizations(id)
pf_portal_credentials_delete(DELETE)pf_portal_credentials_insert(INSERT)pf_portal_credentials_select(SELECT)pf_portal_credentials_update(UPDATE)
pf_portal_definitions
PF-119: a known external web portal + its Terms-of-Service gate (unreviewed/approved/prohibited). A flow cannot be automated until its portal is approved AND the tenant acknowledges the ToS.
RLS: ✅ enabled (4 policies)
Foreign keys:
organization_id→pf_organizations(id)
pf_portal_definitions_delete(DELETE)pf_portal_definitions_insert(INSERT)pf_portal_definitions_select(SELECT)pf_portal_definitions_update(UPDATE)
pf_portal_flows
PF-119: an org-scoped portal automation flow (flow_kind=template platform-authored, or recorded tenant-authored). step_graph is the canonical worker-executable definition.
RLS: ✅ enabled (4 policies)
Foreign keys:
organization_id→pf_organizations(id)portal_id→pf_portal_definitions(id)
pf_portal_flows_delete(DELETE)pf_portal_flows_insert(INSERT)pf_portal_flows_select(SELECT)pf_portal_flows_update(UPDATE)
pf_portal_run_steps
PF-119: per-step audit trail for a run (intent, locator, outcome, screenshot + DOM-snapshot refs, heal from/to locator).
RLS: ✅ enabled (4 policies)
Foreign keys:
organization_id→pf_organizations(id)run_id→pf_portal_runs(id)
pf_portal_run_steps_delete(DELETE)pf_portal_run_steps_insert(INSERT)pf_portal_run_steps_select(SELECT)pf_portal_run_steps_update(UPDATE)
pf_portal_runs
PF-119: one portal-bot execution — status, PHI-redacted input snapshot, extracted result, heal events. Immutable audit trail with pf_portal_run_steps children.
RLS: ✅ enabled (4 policies)
Foreign keys:
flow_id→pf_portal_flows(id)organization_id→pf_organizations(id)schedule_id→pf_portal_schedules(id)
pf_portal_runs_delete(DELETE)pf_portal_runs_insert(INSERT)pf_portal_runs_select(SELECT)pf_portal_runs_update(UPDATE)
pf_portal_schedules
PF-119: schedule rows feeding pf_portal_enqueue_due_runs() (pg_cron -> pgmq workflow_execution_queue, FW-46).
RLS: ✅ enabled (4 policies)
Foreign keys:
flow_id→pf_portal_flows(id)organization_id→pf_organizations(id)
pf_portal_schedules_delete(DELETE)pf_portal_schedules_insert(INSERT)pf_portal_schedules_select(SELECT)pf_portal_schedules_update(UPDATE)
pf_process_execution_snapshots
PF-82: Daily snapshot of process health metrics for trend analysis.
RLS: ✅ enabled (1 policies)
Foreign keys:
organization_id→pf_organizations(id)process_id→pf_business_processes(id)
pf_process_snapshots_select(SELECT)
pf_profiles
RLS: ✅ enabled (5 policies)
Foreign keys:
default_organization_id→pf_organizations(id)id→users(id)portal_patient_id→pm_patients(id)
Users can update own profile(UPDATE)Users can view own profile(SELECT)Users can view profiles in same organization(SELECT)Users can view profiles of employees in same org(SELECT)pf_profiles_same_org_select(SELECT)
pf_provisioning_requests
PF-50: Tenant provisioning requests. Tracks request details before and after org creation. Platform admin only.
RLS: ✅ enabled (4 policies)
Foreign keys:
created_by→pf_profiles(id)organization_id→pf_organizations(id)requested_by→pf_profiles(id)template_id→pf_provisioning_templates(id)updated_by→pf_profiles(id)
pf_provisioning_requests_delete(DELETE)pf_provisioning_requests_insert(INSERT)pf_provisioning_requests_select(SELECT)pf_provisioning_requests_update(UPDATE)
pf_provisioning_steps
PF-50: Step-level progress for each provisioning request. Enables real-time UI and debugging.
RLS: ✅ enabled (4 policies)
Foreign keys:
provisioning_request_id→pf_provisioning_requests(id)
pf_provisioning_steps_delete(DELETE)pf_provisioning_steps_insert(INSERT)pf_provisioning_steps_select(SELECT)pf_provisioning_steps_update(UPDATE)
pf_provisioning_template_assignments
PF-50-EN-01: Records each state-aware template application to an organization with audit metadata.
RLS: ✅ enabled (4 policies)
Foreign keys:
applied_by→pf_profiles(id)created_by→pf_profiles(id)organization_id→pf_organizations(id)rollback_by→pf_profiles(id)template_id→pf_provisioning_templates(id)updated_by→pf_profiles(id)
pf_provisioning_template_assignments_delete(DELETE)pf_provisioning_template_assignments_insert(INSERT)pf_provisioning_template_assignments_select(SELECT)pf_provisioning_template_assignments_update(UPDATE)
pf_provisioning_template_bundles
PF-50-EN-01: Links provisioning templates to jurisdiction profiles, seed bundles, and baseline settings.
RLS: ✅ enabled (4 policies)
Foreign keys:
created_by→pf_profiles(id)template_id→pf_provisioning_templates(id)updated_by→pf_profiles(id)
pf_provisioning_template_bundles_delete(DELETE)pf_provisioning_template_bundles_insert(INSERT)pf_provisioning_template_bundles_select(SELECT)pf_provisioning_template_bundles_update(UPDATE)
pf_provisioning_templates
PF-50: Platform-level provisioning templates for tenant setup. Not org-scoped; managed by platform admins only.
RLS: ✅ enabled (4 policies)
Foreign keys:
created_by→pf_profiles(id)updated_by→pf_profiles(id)
pf_provisioning_templates_delete(DELETE)pf_provisioning_templates_insert(INSERT)pf_provisioning_templates_select(SELECT)pf_provisioning_templates_update(UPDATE)
pf_push_subscriptions
RLS: ✅ enabled (4 policies)
Foreign keys:
created_by→pf_profiles(id)organization_id→pf_organizations(id)updated_by→pf_profiles(id)user_id→pf_profiles(id)
pf_push_subscriptions_delete(DELETE)pf_push_subscriptions_insert(INSERT)pf_push_subscriptions_select(SELECT)pf_push_subscriptions_update(UPDATE)
pf_query_performance_logs
PF-52: Append-only log of query performance metrics. Stores only redacted query text (never raw SQL). Platform admins only.
RLS: ✅ enabled (2 policies)
Foreign keys:
organization_id→pf_organizations(id)user_id→users(id)
pf_query_performance_logs_insert(INSERT)pf_query_performance_logs_select(SELECT)
pf_quick_action_catalog
PF: Optional DB-backed quick action metadata. Seeded from MODULE_REGISTRY by PF-99 (migration 20260418021116). Source of truth remains src/platform/modules/module-registry/*.ts; re-run scripts/dev/print-quick-action-catalog-seed.ts and add a follow-up migration after registry edits.
RLS: ✅ enabled (1 policies)
Policies:
pf_quick_action_catalog_select(SELECT)
pf_quota_violations
PF-43: Quota violation log (append-only for audit)
RLS: ✅ enabled (2 policies)
Foreign keys:
organization_id→pf_organizations(id)quota_id→pf_resource_quotas(id)user_id→pf_profiles(id)
pf_quota_violations_insert(INSERT)pf_quota_violations_select(SELECT)
pf_rate_limit_buckets
RLS: ✅ enabled (4 policies)
Policies:
pf_rate_limit_buckets_deny_delete(DELETE)pf_rate_limit_buckets_deny_insert(INSERT)pf_rate_limit_buckets_deny_select(SELECT)pf_rate_limit_buckets_deny_update(UPDATE)
pf_rate_limit_state
PF-42: Rate limit state tracking. Stores current usage counters per rate limit configuration.
RLS: ✅ enabled (1 policies)
Foreign keys:
organization_id→pf_organizations(id)rate_limit_id→pf_rate_limits(id)
pf_rate_limit_state_select(SELECT)
pf_rate_limit_violations
PF-42: Rate limit violation log. Tracks all rate limit violations for audit and alerting.
RLS: ✅ enabled (1 policies)
Foreign keys:
organization_id→pf_organizations(id)rate_limit_id→pf_rate_limits(id)user_id→users(id)
pf_rate_limit_violations_select(SELECT)
pf_rate_limits
PF-42: Rate limit configuration. Defines rate limits by scope (global/organization/endpoint), algorithm, and apply_to target.
RLS: ✅ enabled (4 policies)
Foreign keys:
created_by→users(id)organization_id→pf_organizations(id)updated_by→users(id)
pf_rate_limits_delete(DELETE)pf_rate_limits_insert(INSERT)pf_rate_limits_select(SELECT)pf_rate_limits_update(UPDATE)
pf_recording_consents
PF-100/PF-96-EN-RECORDING: Jurisdiction-aware recording consent records.
RLS: ✅ enabled (4 policies)
Foreign keys:
created_by→pf_profiles(id)organization_id→pf_organizations(id)participant_id→pf_transcription_session_participants(id)session_id→pf_transcription_sessions(id)updated_by→pf_profiles(id)
recording_consents_delete(DELETE)recording_consents_insert(INSERT)recording_consents_select(SELECT)recording_consents_update(UPDATE)
pf_report_executions
RLS: ✅ enabled (2 policies)
Foreign keys:
executed_by→pf_profiles(id)report_id→pf_reports(id)
Users can create report executions(INSERT)Users can view own executions(SELECT)
pf_report_permissions
RLS: ✅ enabled (4 policies)
Foreign keys:
report_id→pf_reports(id)user_id→pf_profiles(id)
pf_report_permissions_delete(DELETE)pf_report_permissions_insert(INSERT)pf_report_permissions_select(SELECT)pf_report_permissions_update(UPDATE)
pf_report_runs
PF-12: Tracks each execution of a scheduled report for auditing and debugging
RLS: ✅ enabled (3 policies)
Foreign keys:
organization_id→pf_organizations(id)schedule_id→pf_report_schedules(id)
pf_report_runs_insert(INSERT)pf_report_runs_select(SELECT)pf_report_runs_update(UPDATE)
pf_report_schedules
Automated report scheduling and delivery configuration
RLS: ✅ enabled (4 policies)
Foreign keys:
created_by→pf_profiles(id)organization_id→pf_organizations(id)report_id→pf_reports(id)updated_by→users(id)
schedule_delete(DELETE)schedule_insert(INSERT)schedule_select(SELECT)schedule_update(UPDATE)
pf_reports
RLS: ✅ enabled (6 policies)
Foreign keys:
created_by→pf_profiles(id)organization_id→pf_organizations(id)site_id→pf_sites(id)updated_by→users(id)
Users can update own reports(UPDATE)Users can view permitted reports(SELECT)pf_reports_delete(DELETE)pf_reports_insert(INSERT)pf_reports_select(SELECT)pf_reports_update(UPDATE)
pf_resource_quotas
PF-43: Per-organization resource quota configuration
RLS: ✅ enabled (4 policies)
Foreign keys:
created_by→pf_profiles(id)organization_id→pf_organizations(id)updated_by→pf_profiles(id)
pf_resource_quotas_delete(DELETE)pf_resource_quotas_insert(INSERT)pf_resource_quotas_select(SELECT)pf_resource_quotas_update(UPDATE)
pf_resource_usage
PF-43: Resource usage tracking (realtime + aggregated)
RLS: ✅ enabled (4 policies)
Foreign keys:
organization_id→pf_organizations(id)
pf_resource_usage_delete(DELETE)pf_resource_usage_insert(INSERT)pf_resource_usage_select(SELECT)pf_resource_usage_update(UPDATE)
pf_retention_log
PF-18: Audit trail for data lineage retention/archival jobs
RLS: ✅ enabled (1 policies)
Policies:
pf_retention_log_select(SELECT)
pf_retention_policies
PF-46: Data retention policies defining how long entities are kept before archival or deletion
RLS: ✅ enabled (4 policies)
Foreign keys:
created_by→users(id)organization_id→pf_organizations(id)updated_by→users(id)
pf_retention_policies_delete(DELETE)pf_retention_policies_insert(INSERT)pf_retention_policies_select(SELECT)pf_retention_policies_update(UPDATE)
pf_role_permissions
Maps permissions to roles (custom or system)
RLS: ✅ enabled (4 policies)
Foreign keys:
created_by→pf_profiles(id)organization_id→pf_organizations(id)permission_id→pf_module_permissions(id)role_id→pf_custom_roles(id)updated_by→users(id)
pf_role_permissions_delete(DELETE)pf_role_permissions_insert(INSERT)pf_role_permissions_select(SELECT)pf_role_permissions_update(UPDATE)
pf_scheduled_messages
PF-67: Messages scheduled for future delivery
RLS: ✅ enabled (5 policies)
Foreign keys:
conversation_id→pf_conversations(id)organization_id→pf_organizations(id)parent_message_id→pf_messages(id)sender_id→users(id)
pf_scheduled_messages_delete(DELETE)pf_scheduled_messages_insert(INSERT)pf_scheduled_messages_select(SELECT)pf_scheduled_messages_service(ALL)pf_scheduled_messages_update(UPDATE)
pf_security_alert_configs
RLS: ✅ enabled (9 policies)
Foreign keys:
created_by→pf_profiles(id)organization_id→pf_organizations(id)updated_by→pf_profiles(id)
pf_security_alert_configs_delete(DELETE)pf_security_alert_configs_insert(INSERT)pf_security_alert_configs_org_admin_delete(DELETE)pf_security_alert_configs_org_admin_insert(INSERT)pf_security_alert_configs_org_admin_select(SELECT)pf_security_alert_configs_org_admin_update(UPDATE)pf_security_alert_configs_platform_admin_all(ALL)pf_security_alert_configs_select(SELECT)pf_security_alert_configs_update(UPDATE)
pf_security_alert_delivery_failures
PF-48: Dead-letter store for security alert delivery failures. Append-only for audit compliance.
RLS: ✅ enabled (2 policies)
Foreign keys:
alert_config_id→pf_security_alert_configs(id)event_id→pf_security_events(id)organization_id→pf_organizations(id)resolved_by→pf_profiles(id)
pf_security_alert_delivery_failures_org_admin_select(SELECT)pf_security_alert_delivery_failures_platform_admin_select(SELECT)
pf_security_events
RLS: ✅ enabled (3 policies)
Foreign keys:
created_by→pf_profiles(id)organization_id→pf_organizations(id)user_id→pf_profiles(id)
pf_security_events_org_admin_select(SELECT)pf_security_events_own_select(SELECT)pf_security_events_platform_admin_select(SELECT)
pf_service_accounts
PF-97: Machine identity for API access — each service account owns zero or more API keys
RLS: ✅ enabled (4 policies)
Foreign keys:
created_by→pf_profiles(id)organization_id→pf_organizations(id)updated_by→pf_profiles(id)
pf_service_accounts_delete(DELETE)pf_service_accounts_insert(INSERT)pf_service_accounts_select(SELECT)pf_service_accounts_update(UPDATE)
pf_settings_audit
Audit log for module settings changes. INSERT only via trigger functions. Immutable by design. Exempt from custom_fields requirement as per audit log exemption in database guidelines.
RLS: ✅ enabled (4 policies)
Foreign keys:
changed_by→pf_profiles(id)organization_id→pf_organizations(id)
No direct delete on settings audit(DELETE)No direct insert on settings audit(INSERT)No direct update on settings audit(UPDATE)Org admins can view settings audit logs(SELECT)
pf_signature_requests
Tracks signature request lifecycle for document signing workflows
RLS: ✅ enabled (4 policies)
Foreign keys:
created_by→pf_profiles(id)organization_id→pf_organizations(id)requested_by→pf_profiles(id)revoked_by→pf_profiles(id)signature_id→pf_signatures(id)signer_user_id→pf_profiles(id)updated_by→pf_profiles(id)
pf_signature_requests_delete(DELETE)pf_signature_requests_insert(INSERT)pf_signature_requests_select(SELECT)pf_signature_requests_update(UPDATE)
pf_signatures
RLS: ✅ enabled (4 policies)
Foreign keys:
created_by→pf_profiles(id)organization_id→pf_organizations(id)signer_user_id→pf_profiles(id)updated_by→pf_profiles(id)
pf_signatures_delete(DELETE)pf_signatures_insert(INSERT)pf_signatures_select(SELECT)pf_signatures_update(UPDATE)
pf_site_jurisdiction_config
PF-96: Site-level jurisdiction profile override for multi-state organizations.
RLS: ✅ enabled (4 policies)
Foreign keys:
created_by→pf_profiles(id)jurisdiction_profile_id→pf_jurisdiction_profiles(id)organization_id→pf_organizations(id)site_id→pf_sites(id)updated_by→pf_profiles(id)
pf_site_jurisdiction_config_delete(DELETE)pf_site_jurisdiction_config_insert(INSERT)pf_site_jurisdiction_config_select(SELECT)pf_site_jurisdiction_config_update(UPDATE)
pf_sites
RLS: ✅ enabled (9 policies)
Foreign keys:
organization_id→pf_organizations(id)
Users with org access can view sites(SELECT)pf_sites_org_admin_delete(DELETE)pf_sites_org_admin_insert(INSERT)pf_sites_org_admin_select(SELECT)pf_sites_org_admin_update(UPDATE)pf_sites_platform_admin_delete(DELETE)pf_sites_platform_admin_insert(INSERT)pf_sites_platform_admin_select(SELECT)pf_sites_platform_admin_update(UPDATE)
pf_sla_definitions
RLS: ✅ enabled (4 policies)
Foreign keys:
calendar_id→fw_business_calendars(id)created_by→pf_profiles(id)organization_id→pf_organizations(id)updated_by→pf_profiles(id)
pf_sla_definitions_delete(DELETE)pf_sla_definitions_insert(INSERT)pf_sla_definitions_select(SELECT)pf_sla_definitions_update(UPDATE)
pf_sla_instances
RLS: ✅ enabled (3 policies)
Foreign keys:
created_by→pf_profiles(id)definition_id→pf_sla_definitions(id)organization_id→pf_organizations(id)updated_by→pf_profiles(id)
pf_sla_instances_insert(INSERT)pf_sla_instances_select(SELECT)pf_sla_instances_update(UPDATE)
pf_sla_thresholds
PF-36 Phase 2: SLA threshold configurations for custom metrics
RLS: ✅ enabled (4 policies)
Foreign keys:
created_by→users(id)metric_id→pf_custom_metrics(id)organization_id→pf_organizations(id)updated_by→users(id)
pf_sla_thresholds_delete(DELETE)pf_sla_thresholds_insert(INSERT)pf_sla_thresholds_select(SELECT)pf_sla_thresholds_update(UPDATE)
pf_sla_violations
PF-36 Phase 2: Tracks SLA threshold violations. INSERT/UPDATE restricted to service role.
RLS: ✅ enabled (2 policies)
Foreign keys:
acknowledged_by→users(id)metric_id→pf_custom_metrics(id)organization_id→pf_organizations(id)threshold_id→pf_sla_thresholds(id)
pf_sla_violations_acknowledge(UPDATE)pf_sla_violations_select(SELECT)
pf_sso_domain_claims
PF-112: email-domain ownership verification (DNS TXT) gating SSO provider activation.
RLS: ✅ enabled (4 policies)
Foreign keys:
organization_id→pf_organizations(id)
pf_sso_domain_claims_delete(DELETE)pf_sso_domain_claims_insert(INSERT)pf_sso_domain_claims_select(SELECT)pf_sso_domain_claims_update(UPDATE)
pf_swim_lane_diagram_versions
PF-73 Phase 2: Immutable version snapshots for swim lane diagrams.
RLS: ✅ enabled (4 policies)
Foreign keys:
created_by→pf_profiles(id)diagram_id→pf_swim_lane_diagrams(id)organization_id→pf_organizations(id)
pf_swim_lane_diagram_versions_delete(DELETE)pf_swim_lane_diagram_versions_insert(INSERT)pf_swim_lane_diagram_versions_select(SELECT)pf_swim_lane_diagram_versions_update(UPDATE)
pf_swim_lane_diagrams
PF-73: Swim lane diagram definitions (documentation/visualization only).
RLS: ✅ enabled (5 policies)
Foreign keys:
created_by→pf_profiles(id)last_edited_by→pf_profiles(id)organization_id→pf_organizations(id)updated_by→pf_profiles(id)
pf_swim_lane_diagrams_delete(DELETE)pf_swim_lane_diagrams_insert(INSERT)pf_swim_lane_diagrams_platform_templates_select(SELECT)pf_swim_lane_diagrams_select(SELECT)pf_swim_lane_diagrams_update(UPDATE)
pf_task_automation_rules
PF-29: Automation rules that auto-create tasks based on triggers.
RLS: ✅ enabled (4 policies)
Foreign keys:
created_by→pf_profiles(id)organization_id→pf_organizations(id)template_id→pf_task_templates(id)updated_by→pf_profiles(id)
pf_task_automation_rules_delete(DELETE)pf_task_automation_rules_insert(INSERT)pf_task_automation_rules_select(SELECT)pf_task_automation_rules_update(UPDATE)
pf_task_checklist_items
PF-29 Phase 5: Lightweight checklist items belonging to a task. For full subtasks, use pf_tasks.parent_task_id.
RLS: ✅ enabled (4 policies)
Foreign keys:
completed_by→users(id)created_by→users(id)organization_id→pf_organizations(id)task_id→pf_tasks(id)updated_by→users(id)
pf_task_checklist_items_delete(DELETE)pf_task_checklist_items_insert(INSERT)pf_task_checklist_items_select(SELECT)pf_task_checklist_items_update(UPDATE)
pf_task_comments
RLS: ✅ enabled (4 policies)
Foreign keys:
created_by→pf_profiles(id)organization_id→pf_organizations(id)task_id→pf_tasks(id)updated_by→pf_profiles(id)
pf_task_comments_delete(DELETE)pf_task_comments_insert(INSERT)pf_task_comments_select(SELECT)pf_task_comments_update(UPDATE)
pf_task_dependencies
PF-29: Task dependency edges (blocked-by / blocks). Acyclic enforced by trigger.
RLS: ✅ enabled (4 policies)
Foreign keys:
created_by→pf_profiles(id)depends_on_task_id→pf_tasks(id)organization_id→pf_organizations(id)task_id→pf_tasks(id)updated_by→pf_profiles(id)
pf_task_dependencies_delete(DELETE)pf_task_dependencies_insert(INSERT)pf_task_dependencies_select(SELECT)pf_task_dependencies_update(UPDATE)
pf_task_templates
PF-29: Reusable task templates for quick task creation.
RLS: ✅ enabled (4 policies)
Foreign keys:
created_by→pf_profiles(id)organization_id→pf_organizations(id)updated_by→pf_profiles(id)
pf_task_templates_delete(DELETE)pf_task_templates_insert(INSERT)pf_task_templates_select(SELECT)pf_task_templates_update(UPDATE)
pf_task_time_entries
PF-29: Time tracking entries for tasks.
RLS: ✅ enabled (4 policies)
Foreign keys:
created_by→pf_profiles(id)organization_id→pf_organizations(id)task_id→pf_tasks(id)updated_by→pf_profiles(id)user_id→pf_profiles(id)
pf_task_time_entries_delete(DELETE)pf_task_time_entries_insert(INSERT)pf_task_time_entries_select(SELECT)pf_task_time_entries_update(UPDATE)
pf_tasks
RLS: ✅ enabled (4 policies)
Foreign keys:
assigned_by→pf_profiles(id)assigned_to→pf_profiles(id)created_by→pf_profiles(id)organization_id→pf_organizations(id)parent_task_id→pf_tasks(id)site_id→pf_sites(id)updated_by→pf_profiles(id)
pf_tasks_delete(DELETE)pf_tasks_insert(INSERT)pf_tasks_select(SELECT)pf_tasks_update(UPDATE)
pf_teams_notification_config
PF-63: Configuration rules for routing domain events to Microsoft Teams channels
RLS: ✅ enabled (4 policies)
Foreign keys:
created_by→pf_profiles(id)organization_id→pf_organizations(id)updated_by→pf_profiles(id)
pf_teams_notification_config_delete(DELETE)pf_teams_notification_config_insert(INSERT)pf_teams_notification_config_select(SELECT)pf_teams_notification_config_update(UPDATE)
pf_template_usage
RLS: ✅ enabled (2 policies)
Foreign keys:
letterhead_id→pf_letterheads(id)organization_id→pf_organizations(id)template_id→pf_document_templates(id)
Users can insert own usage(INSERT)Users can view org template usage(SELECT)
pf_tenant_domains
PF-77: Tenant custom domains for Vercel multi-tenant. One row per domain; lifecycle states: requested → verification_pending → verified → ssl_pending → active | failed | removed.
RLS: ✅ enabled (4 policies)
Foreign keys:
created_by→pf_profiles(id)organization_id→pf_organizations(id)updated_by→pf_profiles(id)
pf_tenant_domains_delete(DELETE)pf_tenant_domains_insert(INSERT)pf_tenant_domains_select(SELECT)pf_tenant_domains_update(UPDATE)
pf_tenant_themes
PF-95: Per-tenant visual theming configuration (colors, typography, login branding, favicon).
RLS: ✅ enabled (4 policies)
Foreign keys:
created_by→pf_profiles(id)organization_id→pf_organizations(id)updated_by→pf_profiles(id)
pf_tenant_themes_delete(DELETE)pf_tenant_themes_insert(INSERT)pf_tenant_themes_select(SELECT)pf_tenant_themes_update(UPDATE)
pf_transcription_attestations
PF-100: Append-only clinician sign-offs on transcription drafts.
RLS: ✅ enabled (2 policies)
Foreign keys:
attesting_user_id→pf_profiles(id)draft_id→pf_transcription_drafts(id)organization_id→pf_organizations(id)session_id→pf_transcription_sessions(id)
trans_attestations_insert(INSERT)trans_attestations_select(SELECT)
pf_transcription_audit
PF-100: Append-only compliance audit trail. No UPDATE/DELETE.
RLS: ✅ enabled (1 policies)
Foreign keys:
actor_user_id→pf_profiles(id)organization_id→pf_organizations(id)session_id→pf_transcription_sessions(id)
trans_audit_select(SELECT)
pf_transcription_audit_retention_policy
PF-100: Configurable retention rules for transcription audit data.
RLS: ✅ enabled (4 policies)
Foreign keys:
created_by→pf_profiles(id)organization_id→pf_organizations(id)updated_by→pf_profiles(id)
trans_audit_retention_delete(DELETE)trans_audit_retention_insert(INSERT)trans_audit_retention_select(SELECT)trans_audit_retention_update(UPDATE)
pf_transcription_citations
PF-100: Links from draft text spans to source transcript segments.
RLS: ✅ enabled (3 policies)
Foreign keys:
draft_id→pf_transcription_drafts(id)organization_id→pf_organizations(id)segment_id→pf_transcription_segments(id)
trans_citations_delete(DELETE)trans_citations_insert(INSERT)trans_citations_select(SELECT)
pf_transcription_cost_ledger
PF-100: Append-only per-session/per-call cost tracking. No UPDATE/DELETE.
RLS: ✅ enabled (1 policies)
Foreign keys:
organization_id→pf_organizations(id)session_id→pf_transcription_sessions(id)vendor_call_id→pf_transcription_vendor_calls(id)
trans_cost_ledger_select(SELECT)
pf_transcription_draft_revisions
PF-100: Append-only revision history for drafts.
RLS: ✅ enabled (2 policies)
Foreign keys:
draft_id→pf_transcription_drafts(id)edited_by→pf_profiles(id)organization_id→pf_organizations(id)
trans_draft_revisions_insert(INSERT)trans_draft_revisions_select(SELECT)
pf_transcription_drafts
PF-100: AI-generated clinical note drafts. One active draft per session enforced by partial unique index.
RLS: ✅ enabled (4 policies)
Foreign keys:
created_by→pf_profiles(id)organization_id→pf_organizations(id)session_id→pf_transcription_sessions(id)template_id→pf_transcription_templates(id)updated_by→pf_profiles(id)
trans_drafts_delete(DELETE)trans_drafts_insert(INSERT)trans_drafts_select(SELECT)trans_drafts_update(UPDATE)
pf_transcription_jurisdiction_routing
PF-100 H2: Per-org routing rules. jurisdiction_code matches pf_jurisdiction_profiles.state_code; ’*’ wildcard = org default. recording_channel NULL = any channel.
RLS: ✅ enabled (4 policies)
Foreign keys:
llm_vendor_id→pf_transcription_vendors(id)organization_id→pf_organizations(id)stt_vendor_id→pf_transcription_vendors(id)
pf_transcription_jur_routing_delete(DELETE)pf_transcription_jur_routing_insert(INSERT)pf_transcription_jur_routing_select(SELECT)pf_transcription_jur_routing_update(UPDATE)
pf_transcription_module_settings
PF-100: Per-organization transcription configuration. One row per org.
RLS: ✅ enabled (4 policies)
Foreign keys:
created_by→pf_profiles(id)default_template_id→pf_transcription_templates(id)organization_id→pf_organizations(id)updated_by→pf_profiles(id)
trans_module_settings_delete(DELETE)trans_module_settings_insert(INSERT)trans_module_settings_select(SELECT)trans_module_settings_update(UPDATE)
pf_transcription_segments
PF-100: Timestamped speech segments from STT vendor.
RLS: ✅ enabled (4 policies)
Foreign keys:
organization_id→pf_organizations(id)session_id→pf_transcription_sessions(id)
trans_segments_delete(DELETE)trans_segments_insert(INSERT)trans_segments_select(SELECT)trans_segments_update(UPDATE)
pf_transcription_session_participants
RLS: ✅ enabled (4 policies)
Foreign keys:
organization_id→pf_organizations(id)session_id→pf_transcription_sessions(id)user_id→pf_profiles(id)
trans_participants_delete(DELETE)trans_participants_insert(INSERT)trans_participants_select(SELECT)trans_participants_update(UPDATE)
pf_transcription_sessions
PF-100: Ambient transcription sessions. Encounter linkage is app-layer per ADR-018.
RLS: ✅ enabled (4 policies)
Foreign keys:
clinician_user_id→pf_profiles(id)created_by→pf_profiles(id)organization_id→pf_organizations(id)site_id→pf_sites(id)updated_by→pf_profiles(id)
trans_sessions_delete(DELETE)trans_sessions_insert(INSERT)trans_sessions_select(SELECT)trans_sessions_update(UPDATE)
pf_transcription_templates
PF-100: Note generation templates (SOAP/DAP/etc). organization_id NULL = platform-builtin.
RLS: ✅ enabled (4 policies)
Foreign keys:
created_by→pf_profiles(id)organization_id→pf_organizations(id)updated_by→pf_profiles(id)
trans_templates_delete(DELETE)trans_templates_insert(INSERT)trans_templates_select(SELECT)trans_templates_update(UPDATE)
pf_transcription_vendor_baas
PF-100 H2: Per-org Business Associate Agreement (BAA) registry for transcription vendors. Status must be ‘active’ (with valid baa_signed_at) before vendor may be invoked.
RLS: ✅ enabled (4 policies)
Foreign keys:
organization_id→pf_organizations(id)vault_credential_id→pf_credential_vault(id)vendor_id→pf_transcription_vendors(id)
pf_transcription_vendor_baas_delete(DELETE)pf_transcription_vendor_baas_insert(INSERT)pf_transcription_vendor_baas_select(SELECT)pf_transcription_vendor_baas_update(UPDATE)
pf_transcription_vendor_calls
PF-100: Append-only audit log of STT/LLM vendor invocations. No UPDATE/DELETE.
RLS: ✅ enabled (1 policies)
Foreign keys:
draft_id→pf_transcription_drafts(id)organization_id→pf_organizations(id)session_id→pf_transcription_sessions(id)
trans_vendor_calls_select(SELECT)
pf_transcription_vendors
PF-100 H2: Platform-global catalog of supported transcription vendors (STT, LLM, PHI redaction). Read by all authenticated users; write only by platform_admin.
RLS: ✅ enabled (2 policies)
Policies:
pf_transcription_vendors_admin_write(ALL)pf_transcription_vendors_select(SELECT)
pf_user_activation_requests
PF: Activation requests for migrated/imported users pending admin review before org access is granted
RLS: ✅ enabled (4 policies)
Foreign keys:
created_by→users(id)employee_id→hr_employees(id)organization_id→pf_organizations(id)reviewed_by→users(id)user_id→users(id)
pf_activation_requests_admin_select(SELECT)pf_activation_requests_admin_update(UPDATE)pf_activation_requests_user_insert(INSERT)pf_activation_requests_user_select(SELECT)
pf_user_dashboard_preferences
Stores user-specific dashboard widget preferences (visibility, order, etc.)
RLS: ✅ enabled (4 policies)
Foreign keys:
organization_id→pf_organizations(id)user_id→users(id)
pf_user_dashboard_preferences_delete(DELETE)pf_user_dashboard_preferences_insert(INSERT)pf_user_dashboard_preferences_select(SELECT)pf_user_dashboard_preferences_update(UPDATE)
pf_user_devices
PF-49: Tracks user devices via fingerprinting for session management
RLS: ✅ enabled (4 policies)
Foreign keys:
created_by→users(id)organization_id→pf_organizations(id)updated_by→users(id)user_id→users(id)
pf_user_devices_delete(DELETE)pf_user_devices_insert(INSERT)pf_user_devices_select(SELECT)pf_user_devices_update(UPDATE)
pf_user_invitations
RLS: ✅ enabled (4 policies)
Foreign keys:
invited_by→pf_profiles(id)organization_id→pf_organizations(id)site_id→pf_sites(id)
Admins can create invitations(INSERT)Admins can delete invitations(DELETE)Admins can update invitations(UPDATE)Admins can view org invitations(SELECT)
pf_user_role_assignments
User role assignments with optional site scope and expiration
RLS: ✅ enabled (4 policies)
Foreign keys:
assigned_by→pf_profiles(id)organization_id→pf_organizations(id)role_id→pf_custom_roles(id)site_id→pf_sites(id)user_id→pf_profiles(id)
pf_user_role_assignments_delete(DELETE)pf_user_role_assignments_insert(INSERT)pf_user_role_assignments_select(SELECT)pf_user_role_assignments_update(UPDATE)
pf_user_sessions
PF-49: Tracks user sessions with sliding expiration and device correlation
RLS: ✅ enabled (3 policies)
Foreign keys:
created_by→users(id)device_id→pf_user_devices(id)organization_id→pf_organizations(id)terminated_by→users(id)updated_by→users(id)user_id→users(id)
pf_user_sessions_insert(INSERT)pf_user_sessions_select(SELECT)pf_user_sessions_update(UPDATE)
pf_validation_rule_executions
PF-55 Phase 3: Append-only log of validation failures (no PHI).
RLS: ✅ enabled (2 policies)
Foreign keys:
created_by→users(id)organization_id→pf_organizations(id)rule_id→pf_validation_rules(id)
pf_validation_rule_executions_insert(INSERT)pf_validation_rule_executions_select(SELECT)
pf_validation_rules
PF-55 Phase 2: Organization-scoped validation rule definitions (type + params).
RLS: ✅ enabled (4 policies)
Foreign keys:
created_by→users(id)organization_id→pf_organizations(id)updated_by→users(id)
pf_validation_rules_delete(DELETE)pf_validation_rules_insert(INSERT)pf_validation_rules_select(SELECT)pf_validation_rules_update(UPDATE)
pf_webhook_deliveries
RLS: ✅ enabled (1 policies)
Foreign keys:
integration_id→pf_integrations(id)organization_id→pf_organizations(id)outbound_webhook_id→pf_outbound_webhooks(id)
pf_webhook_deliveries_select(SELECT)
pf_wizard_analytics_events
Wizard execution analytics. JSONB columns must not contain PHI/PII - use sanitizeAnalyticsEvent utility.
RLS: ✅ enabled (2 policies)
Foreign keys:
organization_id→pf_organizations(id)template_id→pf_wizard_templates(id)user_id→pf_profiles(id)
pf_wizard_analytics_insert(INSERT)pf_wizard_analytics_select(SELECT)
pf_wizard_executions
RLS: ✅ enabled (5 policies)
Foreign keys:
locked_by→users(id)organization_id→pf_organizations(id)template_id→pf_wizard_templates(id)user_id→users(id)
pf_wizard_executions_admin_view(SELECT)pf_wizard_executions_delete(DELETE)pf_wizard_executions_insert(INSERT)pf_wizard_executions_select(SELECT)pf_wizard_executions_update(UPDATE)
pf_wizard_marketplace_listings
RLS: ✅ enabled (4 policies)
Foreign keys:
created_by→pf_profiles(id)organization_id→pf_organizations(id)template_id→pf_wizard_templates(id)updated_by→pf_profiles(id)
pf_marketplace_listings_delete(DELETE)pf_marketplace_listings_insert(INSERT)pf_marketplace_listings_select(SELECT)pf_marketplace_listings_update(UPDATE)
pf_wizard_org_defaults
PF-41: Org-level default wizard config. Templates inherit these when not overridden.
RLS: ✅ enabled (4 policies)
Foreign keys:
created_by→users(id)organization_id→pf_organizations(id)updated_by→users(id)
pf_wizard_org_defaults_delete(DELETE)pf_wizard_org_defaults_insert(INSERT)pf_wizard_org_defaults_select(SELECT)pf_wizard_org_defaults_update(UPDATE)
pf_wizard_template_versions
PF-41: Stores version history for wizard templates, enabling rollback and audit trail
RLS: ✅ enabled (4 policies)
Foreign keys:
created_by→pf_profiles(id)organization_id→pf_organizations(id)published_by→pf_profiles(id)template_id→pf_wizard_templates(id)updated_by→pf_profiles(id)
pf_wizard_versions_delete(DELETE)pf_wizard_versions_insert(INSERT)pf_wizard_versions_select(SELECT)pf_wizard_versions_update(UPDATE)
pf_wizard_templates
PF-41: Configurable wizard templates for module onboarding, admissions, leave, and setup workflows
RLS: ✅ enabled (4 policies)
Foreign keys:
cloned_from_listing_id→pf_wizard_marketplace_listings(id)marketplace_listing_id→pf_wizard_marketplace_listings(id)created_by→pf_profiles(id)current_version_id→pf_wizard_template_versions(id)locked_by→users(id)organization_id→pf_organizations(id)source_template_id→pf_wizard_templates(id)updated_by→pf_profiles(id)
pf_wizard_templates_delete(DELETE)pf_wizard_templates_insert(INSERT)pf_wizard_templates_select(SELECT)pf_wizard_templates_update(UPDATE)