Generated by npm run db:docs:generate — DO NOT EDIT BY HAND. Change the schema via a migration, then regenerate.
Core: ce_ · Tables: 64 · Source generated: 2026-06-10T02:55:32.169Z
Entity relationships
Tables
ce_activities
CE-04: Activity log for contacts and partners
RLS: ✅ enabled (4 policies)
Foreign keys:
call_id→ce_calls(id)created_by→pf_profiles(id)follow_up_task_id→pf_tasks(id)organization_id→pf_organizations(id)updated_by→pf_profiles(id)
ce_activities_delete(DELETE)ce_activities_insert(INSERT)ce_activities_select(SELECT)ce_activities_update(UPDATE)
ce_calendar_connections
CE-21: User OAuth connections to external calendar providers (Google, Microsoft)
RLS: ✅ enabled (4 policies)
Foreign keys:
access_token_credential_id→pf_credential_vault(id)created_by→pf_profiles(id)gws_connection_id→pf_google_workspace_connections(id)organization_id→pf_organizations(id)refresh_token_credential_id→pf_credential_vault(id)updated_by→pf_profiles(id)user_id→pf_profiles(id)
ce_calendar_connections_delete(DELETE)ce_calendar_connections_insert(INSERT)ce_calendar_connections_select(SELECT)ce_calendar_connections_update(UPDATE)
ce_calendar_events
CE-21: Mapping between external calendar events and CE activities
RLS: ✅ enabled (4 policies)
Foreign keys:
activity_id→ce_activities(id)calendar_connection_id→ce_calendar_connections(id)created_by→pf_profiles(id)organization_id→pf_organizations(id)updated_by→pf_profiles(id)
ce_calendar_events_delete(DELETE)ce_calendar_events_insert(INSERT)ce_calendar_events_select(SELECT)ce_calendar_events_update(UPDATE)
ce_calls
CE-03: Call records from RingCentral webhooks and manual entry. All calls should be recorded for compliance.
RLS: ✅ enabled (3 policies)
Foreign keys:
contact_id→ce_contacts(id)created_by→pf_profiles(id)dispositioned_by→pf_profiles(id)organization_id→pf_organizations(id)partner_id→ce_partners(id)user_id→pf_profiles(id)
ce_calls_insert(INSERT)ce_calls_select(SELECT)ce_calls_update(UPDATE)
ce_campaigns
Marketing campaigns for tracking outreach, awareness, and referral drives
RLS: ✅ enabled (4 policies)
Foreign keys:
created_by→users(id)organization_id→pf_organizations(id)updated_by→users(id)
ce_campaigns_delete(DELETE)ce_campaigns_insert(INSERT)ce_campaigns_select(SELECT)ce_campaigns_update(UPDATE)
ce_consent_evidence
RLS: ✅ enabled (2 policies)
Foreign keys:
contact_id→ce_contacts(id)created_by→pf_profiles(id)organization_id→pf_organizations(id)
ce_consent_evidence_insert(INSERT)ce_consent_evidence_select(SELECT)
ce_contact_audit_log
CE-60: Immutable contact activity/audit timeline rows. Append-only via SECURITY DEFINER helper ce_log_contact_audit_event.
RLS: ✅ enabled (2 policies)
Foreign keys:
actor_id→pf_profiles(id)contact_id→ce_contacts(id)created_by→pf_profiles(id)organization_id→pf_organizations(id)
ce_contact_audit_log_insert_denied(INSERT)ce_contact_audit_log_select(SELECT)
ce_contact_document_extraction_audit
CE-59 Phase 2 (CAC-6): Append-only audit of AI extraction outcomes. Records every Apply Confirmed and every blocked attempt (Part 2 / redaction).
RLS: ✅ enabled (2 policies)
Foreign keys:
contact_id→ce_contacts(id)document_id→ce_contact_documents(id)organization_id→pf_organizations(id)
ce_doc_extraction_audit_insert(INSERT)ce_doc_extraction_audit_select(SELECT)
ce_contact_documents
CE-59: Contact-attached documents. Soft-deleted via deleted_at.
RLS: ✅ enabled (4 policies)
Foreign keys:
contact_id→ce_contacts(id)created_by→users(id)organization_id→pf_organizations(id)updated_by→users(id)
ce_contact_documents_delete(DELETE)ce_contact_documents_insert(INSERT)ce_contact_documents_select(SELECT)ce_contact_documents_update(UPDATE)
ce_contact_relationships
CE-20: Directed contact-to-contact relationship edges with soft-delete. Two rows per bi-directional relationship.
RLS: ✅ enabled (4 policies)
Foreign keys:
contact_id→ce_contacts(id)created_by→pf_profiles(id)organization_id→pf_organizations(id)related_contact_id→ce_contacts(id)updated_by→pf_profiles(id)
ce_contact_relationships_delete(DELETE)ce_contact_relationships_insert(INSERT)ce_contact_relationships_select(SELECT)ce_contact_relationships_update(UPDATE)
ce_contact_segments
Dynamic contact segments based on criteria filters
RLS: ✅ enabled (4 policies)
Foreign keys:
created_by→users(id)organization_id→pf_organizations(id)updated_by→users(id)
ce_contact_segments_delete(DELETE)ce_contact_segments_insert(INSERT)ce_contact_segments_select(SELECT)ce_contact_segments_update(UPDATE)
ce_contact_tag_assignments
CE-61: Many-to-many assignment of tags to contacts. Append/remove only; no updates.
RLS: ✅ enabled (3 policies)
Foreign keys:
assigned_by→pf_profiles(id)contact_id→ce_contacts(id)organization_id→pf_organizations(id)tag_id→ce_contact_tags(id)
ce_tag_assignments_delete(DELETE)ce_tag_assignments_insert(INSERT)ce_tag_assignments_select(SELECT)
ce_contact_tags
CE-61: Organization-scoped tag definitions applied to contacts (e.g., High Acuity, Do Not Admit).
RLS: ✅ enabled (4 policies)
Foreign keys:
created_by→pf_profiles(id)organization_id→pf_organizations(id)updated_by→pf_profiles(id)
ce_tags_delete(DELETE)ce_tags_insert(INSERT)ce_tags_select(SELECT)ce_tags_update(UPDATE)
ce_contacts
CE module contacts - leads, referral contacts, prospects, and community members
RLS: ✅ enabled (4 policies)
Foreign keys:
created_by→pf_profiles(id)organization_id→pf_organizations(id)updated_by→pf_profiles(id)partner_id→ce_partners(id)referral_source_id→ce_referral_sources(id)
ce_contacts_delete(DELETE)ce_contacts_insert(INSERT)ce_contacts_select(SELECT)ce_contacts_update(UPDATE)
ce_contract_renewal_log
CE-24: Append-only audit log of contract renewal actions and notification dispatch.
RLS: ✅ enabled (2 policies)
Foreign keys:
contract_id→ce_partner_contracts(id)created_by→pf_profiles(id)organization_id→pf_organizations(id)
ce_contract_renewal_log_insert(INSERT)ce_contract_renewal_log_select(SELECT)
ce_crisis_alerts
CE-28-EN-01: Suspected crisis interactions detected from inbound channels. PHI-safe (excerpt is redacted; payloads/events use IDs only).
RLS: ✅ enabled (3 policies)
Foreign keys:
contact_id→ce_contacts(id)created_by→pf_profiles(id)organization_id→pf_organizations(id)reviewer_id→pf_profiles(id)routed_to→pf_profiles(id)screening_attempt_id→ce_screening_attempts(id)updated_by→pf_profiles(id)
ce_crisis_alerts_insert(INSERT)ce_crisis_alerts_select(SELECT)ce_crisis_alerts_update(UPDATE)
ce_email_accounts
CE-07: OAuth credentials for Gmail/Outlook email integrations
RLS: ✅ enabled (4 policies)
Foreign keys:
access_token_vault_id→pf_credential_vault(id)created_by→pf_profiles(id)organization_id→pf_organizations(id)refresh_token_vault_id→pf_credential_vault(id)updated_by→pf_profiles(id)user_id→pf_profiles(id)
ce_email_accounts_delete(DELETE)ce_email_accounts_insert(INSERT)ce_email_accounts_select(SELECT)ce_email_accounts_update(UPDATE)
ce_email_messages
CE-07: Synced email messages with contact/lead/partner matching
RLS: ✅ enabled (4 policies)
Foreign keys:
contact_id→ce_contacts(id)created_by→pf_profiles(id)email_account_id→ce_email_accounts(id)lead_id→ce_leads(id)organization_id→pf_organizations(id)partner_id→ce_partners(id)
ce_email_messages_delete(DELETE)ce_email_messages_insert(INSERT)ce_email_messages_select(SELECT)ce_email_messages_update(UPDATE)
ce_email_templates
CE-07: Admin-managed email templates for common communications
RLS: ✅ enabled (4 policies)
Foreign keys:
created_by→pf_profiles(id)organization_id→pf_organizations(id)updated_by→pf_profiles(id)
ce_email_templates_delete(DELETE)ce_email_templates_insert(INSERT)ce_email_templates_select(SELECT)ce_email_templates_update(UPDATE)
ce_email_tracking_events
CE-07: Email open/click tracking events (audit table)
RLS: ✅ enabled (1 policies)
Foreign keys:
email_message_id→ce_email_messages(id)organization_id→pf_organizations(id)
ce_email_tracking_events_select(SELECT)
ce_event_attendees
RLS: ✅ enabled (4 policies)
Foreign keys:
checked_in_by→pf_profiles(id)contact_id→ce_contacts(id)created_by→pf_profiles(id)event_id→ce_events(id)organization_id→pf_organizations(id)updated_by→pf_profiles(id)
ce_event_attendees_delete(DELETE)ce_event_attendees_insert(INSERT)ce_event_attendees_select(SELECT)ce_event_attendees_update(UPDATE)
ce_events
RLS: ✅ enabled (4 policies)
Foreign keys:
campaign_id→ce_campaigns(id)created_by→pf_profiles(id)organization_id→pf_organizations(id)updated_by→pf_profiles(id)
ce_events_delete(DELETE)ce_events_insert(INSERT)ce_events_select(SELECT)ce_events_update(UPDATE)
ce_insurance_access_audit
CE-65 / CAC-006: Append-only audit of unmasked insurance member-ID views and insurance field edits. NEVER stores cleartext insurance_member_id.
RLS: ✅ enabled (4 policies)
Foreign keys:
contact_id→ce_contacts(id)organization_id→pf_organizations(id)
ce_insurance_audit_insert(INSERT)ce_insurance_audit_no_delete(DELETE)ce_insurance_audit_no_update(UPDATE)ce_insurance_audit_select(SELECT)
ce_intake_oncall_rotations
CE-28-EN-02: After-hours intake on-call rotations with escalation ladder.
RLS: ✅ enabled (4 policies)
Foreign keys:
created_by→pf_profiles(id)organization_id→pf_organizations(id)updated_by→pf_profiles(id)
ce_intake_oncall_rotations_delete(DELETE)ce_intake_oncall_rotations_insert(INSERT)ce_intake_oncall_rotations_select(SELECT)ce_intake_oncall_rotations_update(UPDATE)
ce_lead_assignment_queue
CE-10: Round-robin lead assignment queue configuration
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)web_form_id→ce_web_forms(id)
ce_lead_assignment_queue_delete(DELETE)ce_lead_assignment_queue_insert(INSERT)ce_lead_assignment_queue_select(SELECT)ce_lead_assignment_queue_update(UPDATE)
ce_lead_closures
CE-63: Immutable closure facts for a lead (append-only). updated_* mirror constitution audit defaults; application must not issue UPDATE.
RLS: ✅ enabled (2 policies)
Foreign keys:
created_by→pf_profiles(id)lead_id→ce_leads(id)organization_id→pf_organizations(id)updated_by→pf_profiles(id)
ce_lead_closures_insert(INSERT)ce_lead_closures_select(SELECT)
ce_lead_conversions
CE-29: Audit trail for lead-to-patient/resident conversions. INSERT-only.
RLS: ✅ enabled (4 policies)
Foreign keys:
converted_by→users(id)created_by→users(id)lead_id→ce_leads(id)organization_id→pf_organizations(id)patient_id→pm_patients(id)
ce_lead_conversions_delete_deny(DELETE)ce_lead_conversions_insert(INSERT)ce_lead_conversions_select(SELECT)ce_lead_conversions_update_deny(UPDATE)
ce_lead_field_audit
CE-58: Per-field audit trail for ce_leads intake fields (urgency, requested_services, etc.). One row per changed field, written by the ce_leads_field_audit_trigger.
RLS: ✅ enabled (1 policies)
Foreign keys:
lead_id→ce_leads(id)organization_id→pf_organizations(id)
ce_lead_field_audit_select(SELECT)
ce_lead_stages
CE module lead pipeline stages - configurable per organization with auto-seeded defaults
RLS: ✅ enabled (4 policies)
Foreign keys:
organization_id→pf_organizations(id)track_id→ce_pipeline_tracks(id)
ce_lead_stages_delete(DELETE)ce_lead_stages_insert(INSERT)ce_lead_stages_select(SELECT)ce_lead_stages_update(UPDATE)
ce_leads
CE module leads - tracks potential residents/clients through pipeline stages
RLS: ✅ enabled (4 policies)
Foreign keys:
assigned_to→pf_profiles(id)campaign_id→ce_campaigns(id)contact_id→ce_contacts(id)converted_by→pf_profiles(id)created_by→pf_profiles(id)lead_stage_id→ce_lead_stages(id)organization_id→pf_organizations(id)site_id→pf_sites(id)track_id→ce_pipeline_tracks(id)updated_by→pf_profiles(id)partner_id→ce_partners(id)referral_source_id→ce_referral_sources(id)
ce_leads_delete(DELETE)ce_leads_insert(INSERT)ce_leads_select(SELECT)ce_leads_update(UPDATE)
ce_message_routing_rules
CE-08-ENHANCEMENTS EN-05: outbound sender routing precedence rules by organization context.
RLS: ✅ enabled (4 policies)
Foreign keys:
created_by→pf_profiles(id)organization_id→pf_organizations(id)updated_by→pf_profiles(id)
ce_message_routing_rules_delete(DELETE)ce_message_routing_rules_insert(INSERT)ce_message_routing_rules_select(SELECT)ce_message_routing_rules_update(UPDATE)
ce_module_settings
CE module configuration settings per organization
RLS: ✅ enabled (4 policies)
Foreign keys:
created_by→users(id)default_lead_stage_id→ce_lead_stages(id)intake_after_hours_routing_id→ce_intake_oncall_rotations(id)organization_id→pf_organizations(id)updated_by→users(id)web_form_default_lead_stage_id→ce_lead_stages(id)
ce_module_settings_delete(DELETE)ce_module_settings_insert(INSERT)ce_module_settings_select(SELECT)ce_module_settings_update(UPDATE)
ce_partner_contacts
CE-02: Junction table linking contacts to partner organizations
RLS: ✅ enabled (4 policies)
Foreign keys:
contact_id→ce_contacts(id)created_by→pf_profiles(id)partner_id→ce_partners(id)
ce_partner_contacts_delete(DELETE)ce_partner_contacts_insert(INSERT)ce_partner_contacts_select(SELECT)ce_partner_contacts_update(UPDATE)
ce_partner_contracts
CE-02: Lightweight partner contracts/agreements. For full governance (approvals, obligations, milestones), link to gr_contracts via gr_contract_id.
RLS: ✅ enabled (4 policies)
Foreign keys:
created_by→pf_profiles(id)organization_id→pf_organizations(id)partner_id→ce_partners(id)updated_by→pf_profiles(id)
ce_partner_contracts_delete(DELETE)ce_partner_contracts_insert(INSERT)ce_partner_contracts_select(SELECT)ce_partner_contracts_update(UPDATE)
ce_partner_documents
CE-24: Partner documents (contracts, certificates, protocols) categorized by type with version chain via supersedes_id.
RLS: ✅ enabled (3 policies)
Foreign keys:
contract_id→ce_partner_contracts(id)created_by→pf_profiles(id)organization_id→pf_organizations(id)partner_id→ce_partners(id)supersedes_id→ce_partner_documents(id)updated_by→pf_profiles(id)
ce_partner_documents_insert(INSERT)ce_partner_documents_select(SELECT)ce_partner_documents_update(UPDATE)
ce_partner_milestones
RLS: ✅ enabled (4 policies)
Foreign keys:
created_by→pf_profiles(id)organization_id→pf_organizations(id)updated_by→pf_profiles(id)
ce_partner_milestones_delete(DELETE)ce_partner_milestones_insert(INSERT)ce_partner_milestones_select(SELECT)ce_partner_milestones_update(UPDATE)
ce_partner_progress
RLS: ✅ enabled (4 policies)
Foreign keys:
created_by→pf_profiles(id)form_submission_id→fw_form_submissions(id)organization_id→pf_organizations(id)partner_id→ce_partners(id)updated_by→pf_profiles(id)
ce_partner_progress_delete(DELETE)ce_partner_progress_insert(INSERT)ce_partner_progress_select(SELECT)ce_partner_progress_update(UPDATE)
ce_partners
CE-02: Partner organizations (hospitals, treatment centers, payers, etc.)
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)primary_contact_id→ce_contacts(id)
ce_partners_delete(DELETE)ce_partners_insert(INSERT)ce_partners_select(SELECT)ce_partners_update(UPDATE)
ce_pipeline_tracks
CE-64: Service line pipeline tracks. Each track is an independent kanban row with its own stage list.
RLS: ✅ enabled (4 policies)
Foreign keys:
created_by→users(id)organization_id→pf_organizations(id)updated_by→users(id)
ce_pipeline_tracks_delete(DELETE)ce_pipeline_tracks_insert(INSERT)ce_pipeline_tracks_select(SELECT)ce_pipeline_tracks_update(UPDATE)
ce_prior_auth_audit_log
CE-69: Append-only audit trail for PA actions. PHI MUST NOT appear in details. Insert only via ce_log_prior_auth_event().
RLS: ✅ enabled (2 policies)
Foreign keys:
actor_id→pf_profiles(id)prior_auth_id→ce_prior_auth_submissions(id)
ce_prior_auth_audit_log_insert_denied(INSERT)ce_prior_auth_audit_log_select(SELECT)
ce_prior_auth_submissions
CE-69: UHC/Optum AZ IOP prior-authorization submissions, tenant-isolated.
RLS: ✅ enabled (3 policies)
Foreign keys:
last_status_update_by→pf_profiles(id)lead_id→ce_leads(id)submitted_by→pf_profiles(id)
ce_prior_auth_submissions_insert(INSERT)ce_prior_auth_submissions_select(SELECT)ce_prior_auth_submissions_update(UPDATE)
ce_referral_sources
CE-02: Referral source tracking for leads and contacts
RLS: ✅ enabled (4 policies)
Foreign keys:
created_by→pf_profiles(id)organization_id→pf_organizations(id)partner_id→ce_partners(id)site_id→pf_sites(id)updated_by→pf_profiles(id)
ce_referral_sources_delete(DELETE)ce_referral_sources_insert(INSERT)ce_referral_sources_select(SELECT)ce_referral_sources_update(UPDATE)
ce_ringcentral_extensions
CE-03: Maps RingCentral extension numbers to pf_profiles. Used to identify user_id from webhook events.
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)
ce_rc_ext_delete(DELETE)ce_rc_ext_insert(INSERT)ce_rc_ext_select(SELECT)ce_rc_ext_update(UPDATE)
ce_ringcentral_subscriptions
CE-03: Tracks RingCentral webhook subscriptions. Subscriptions expire after ~7 days and must be renewed.
RLS: ✅ enabled (2 policies)
Foreign keys:
organization_id→pf_organizations(id)
ce_rc_subs_select_admin(SELECT)ce_rc_subs_select_member(SELECT)
ce_ringout_sessions
RLS: ✅ enabled (4 policies)
Foreign keys:
call_id→ce_calls(id)contact_id→ce_contacts(id)created_by→pf_profiles(id)organization_id→pf_organizations(id)partner_id→ce_partners(id)updated_by→pf_profiles(id)user_id→pf_profiles(id)
ce_ringout_sessions_delete(DELETE)ce_ringout_sessions_insert(INSERT)ce_ringout_sessions_select(SELECT)ce_ringout_sessions_update(UPDATE)
ce_scheduled_messages
CE-08-ENHANCEMENTS EN-02: queued outbound SMS executions with timezone-resolved schedule metadata.
RLS: ✅ enabled (4 policies)
Foreign keys:
contact_id→ce_contacts(id)created_by→pf_profiles(id)organization_id→pf_organizations(id)template_id→ce_sms_templates(id)updated_by→pf_profiles(id)
ce_scheduled_messages_delete(DELETE)ce_scheduled_messages_insert(INSERT)ce_scheduled_messages_select(SELECT)ce_scheduled_messages_update(UPDATE)
ce_scheduled_messages_archive
CE-08 EN-02: long-term archive of terminal-state scheduled SMS records (>=90 days old).
RLS: ✅ enabled (1 policies)
Foreign keys:
organization_id→pf_organizations(id)
ce_scheduled_messages_archive_select(SELECT)
ce_screening_attempts
CE-28: Tracks each intake screening attempt for a lead
RLS: ✅ enabled (3 policies)
Foreign keys:
created_by→pf_profiles(id)crisis_alert_id→ce_crisis_alerts(id)lead_id→ce_leads(id)organization_id→pf_organizations(id)screener_id→pf_profiles(id)screening_outcome_id→ce_screening_results(id)site_id→pf_sites(id)updated_by→pf_profiles(id)
ce_screening_attempts_insert(INSERT)ce_screening_attempts_select(SELECT)ce_screening_attempts_update(UPDATE)
ce_screening_questionnaires
CE-28: Questionnaire templates per program type for intake screening
RLS: ✅ enabled (3 policies)
Foreign keys:
created_by→pf_profiles(id)organization_id→pf_organizations(id)updated_by→pf_profiles(id)
ce_screening_questionnaires_insert(INSERT)ce_screening_questionnaires_select(SELECT)ce_screening_questionnaires_update(UPDATE)
ce_screening_results
CE-28: Detailed screening questionnaire responses and calculated scores
RLS: ✅ enabled (3 policies)
Foreign keys:
created_by→pf_profiles(id)organization_id→pf_organizations(id)updated_by→pf_profiles(id)
ce_screening_results_insert(INSERT)ce_screening_results_select(SELECT)ce_screening_results_update(UPDATE)
ce_screening_sla_config
CE-28: SLA thresholds per program/site for intake screening
RLS: ✅ enabled (3 policies)
Foreign keys:
created_by→pf_profiles(id)organization_id→pf_organizations(id)site_id→pf_sites(id)updated_by→pf_profiles(id)
ce_screening_sla_config_insert(INSERT)ce_screening_sla_config_select(SELECT)ce_screening_sla_config_update(UPDATE)
ce_sequence_enrollments
CE-13: Tracks leads enrolled in follow-up sequences, their progress, and exit reasons.
RLS: ✅ enabled (4 policies)
Foreign keys:
contact_id→ce_contacts(id)current_step_id→ce_sequence_steps(id)enrolled_by→pf_profiles(id)lead_id→ce_leads(id)organization_id→pf_organizations(id)sequence_id→ce_sequences(id)updated_by→pf_profiles(id)
ce_sequence_enrollments_delete(DELETE)ce_sequence_enrollments_insert(INSERT)ce_sequence_enrollments_select(SELECT)ce_sequence_enrollments_update(UPDATE)
ce_sequence_execution_log
CE-13: Append-only log of sequence step executions.
RLS: ✅ enabled (2 policies)
Foreign keys:
enrollment_id→ce_sequence_enrollments(id)organization_id→pf_organizations(id)step_id→ce_sequence_steps(id)
ce_sequence_execution_log_insert(INSERT)ce_sequence_execution_log_select(SELECT)
ce_sequence_outbound_executions
CE-13: Internal idempotency ledger for sequence step dispatch. Intentionally omits custom_fields because it stores only system-managed execution state.
RLS: ✅ enabled (4 policies)
Foreign keys:
created_by→pf_profiles(id)enrollment_id→ce_sequence_enrollments(id)organization_id→pf_organizations(id)step_id→ce_sequence_steps(id)updated_by→pf_profiles(id)
ce_sequence_outbound_executions_delete(DELETE)ce_sequence_outbound_executions_insert(INSERT)ce_sequence_outbound_executions_select(SELECT)ce_sequence_outbound_executions_update(UPDATE)
ce_sequence_steps
CE-13: Individual steps in a follow-up sequence (email, SMS, or task).
RLS: ✅ enabled (4 policies)
Foreign keys:
created_by→pf_profiles(id)email_template_id→ce_email_templates(id)organization_id→pf_organizations(id)sequence_id→ce_sequences(id)sms_template_id→ce_sms_templates(id)updated_by→pf_profiles(id)
ce_sequence_steps_delete(DELETE)ce_sequence_steps_insert(INSERT)ce_sequence_steps_select(SELECT)ce_sequence_steps_update(UPDATE)
ce_sequences
CE-13: Sequence templates for automated multi-step lead follow-up (email, SMS, task).
RLS: ✅ enabled (4 policies)
Foreign keys:
created_by→pf_profiles(id)organization_id→pf_organizations(id)updated_by→pf_profiles(id)
ce_sequences_delete(DELETE)ce_sequences_insert(INSERT)ce_sequences_select(SELECT)ce_sequences_update(UPDATE)
ce_sms_consent
TCPA compliance tracking for SMS consent per phone number
RLS: ✅ enabled (4 policies)
Foreign keys:
contact_id→ce_contacts(id)created_by→pf_profiles(id)organization_id→pf_organizations(id)updated_by→pf_profiles(id)
ce_sms_consent_delete(DELETE)ce_sms_consent_insert(INSERT)ce_sms_consent_select(SELECT)ce_sms_consent_update(UPDATE)
ce_sms_messages
SMS message log for inbound and outbound messages
RLS: ✅ enabled (4 policies)
Foreign keys:
activity_id→ce_activities(id)contact_id→ce_contacts(id)created_by→pf_profiles(id)lead_id→ce_leads(id)organization_id→pf_organizations(id)partner_id→ce_partners(id)template_id→ce_sms_templates(id)updated_by→pf_profiles(id)
ce_sms_messages_delete(DELETE)ce_sms_messages_insert(INSERT)ce_sms_messages_select(SELECT)ce_sms_messages_update(UPDATE)
ce_sms_templates
Reusable SMS message templates with merge field support
RLS: ✅ enabled (4 policies)
Foreign keys:
created_by→pf_profiles(id)organization_id→pf_organizations(id)updated_by→pf_profiles(id)
ce_sms_templates_delete(DELETE)ce_sms_templates_insert(INSERT)ce_sms_templates_select(SELECT)ce_sms_templates_update(UPDATE)
ce_suppression_audit_log
RLS: ✅ enabled (2 policies)
Foreign keys:
contact_id→ce_contacts(id)created_by→pf_profiles(id)organization_id→pf_organizations(id)suppression_id→ce_suppressions(id)
ce_suppression_audit_log_insert(INSERT)ce_suppression_audit_log_select(SELECT)
ce_suppressions
RLS: ✅ enabled (4 policies)
Foreign keys:
contact_id→ce_contacts(id)created_by→pf_profiles(id)organization_id→pf_organizations(id)updated_by→pf_profiles(id)
ce_suppressions_delete(DELETE)ce_suppressions_insert(INSERT)ce_suppressions_select(SELECT)ce_suppressions_update(UPDATE)
ce_unmatched_calls
Temporary storage for RingCentral webhook events that could not be matched to an organization.
Records are moved to ce_calls once organization is resolved. Service-role only access.
RLS: ✅ enabled (4 policies)
Foreign keys:
organization_id→pf_organizations(id)resolved_by→pf_profiles(id)resolved_organization_id→pf_organizations(id)
ce_unmatched_calls_service_role_delete(DELETE)ce_unmatched_calls_service_role_insert(INSERT)ce_unmatched_calls_service_role_select(SELECT)ce_unmatched_calls_service_role_update(UPDATE)
ce_web_form_submissions
CE-10: Web form submission records with UTM tracking
RLS: ✅ enabled (4 policies)
Foreign keys:
assigned_to→pf_profiles(id)contact_id→ce_contacts(id)created_by→pf_profiles(id)lead_id→ce_leads(id)organization_id→pf_organizations(id)updated_by→pf_profiles(id)web_form_id→ce_web_forms(id)
ce_web_form_submissions_delete(DELETE)ce_web_form_submissions_insert(INSERT)ce_web_form_submissions_select(SELECT)ce_web_form_submissions_update(UPDATE)
ce_web_forms
CE-10: Web form configurations for lead capture
RLS: ✅ enabled (4 policies)
Foreign keys:
created_by→pf_profiles(id)default_assignee_id→pf_profiles(id)organization_id→pf_organizations(id)updated_by→pf_profiles(id)
ce_web_forms_delete(DELETE)ce_web_forms_insert(INSERT)ce_web_forms_select(SELECT)ce_web_forms_update(UPDATE)