Generated by npm run db:docs:generate — DO NOT EDIT BY HAND. Change the schema via a migration, then regenerate.
Core: fw_ · Tables: 102 · Source generated: 2026-06-10T02:55:32.169Z
Entity relationships
Tables
fw_action_templates
Pre-built action templates for common automation workflows
RLS: ✅ enabled (4 policies)
Foreign keys:
created_by→pf_profiles(id)organization_id→pf_organizations(id)updated_by→users(id)
Authenticated users can view templates(SELECT)Users can create org templates(INSERT)Users can delete own templates(DELETE)Users can update own templates(UPDATE)
fw_api_connections
RLS: ✅ enabled (4 policies)
Foreign keys:
created_by→pf_profiles(id)organization_id→pf_organizations(id)updated_by→pf_profiles(id)
fw_api_connections_delete(DELETE)fw_api_connections_insert(INSERT)fw_api_connections_select(SELECT)fw_api_connections_update(UPDATE)
fw_approval_assignments
RLS: ✅ enabled (4 policies)
Foreign keys:
assignee_id→pf_profiles(id)created_by→pf_profiles(id)delegated_from_id→pf_profiles(id)delegation_id→fw_approval_delegations(id)escalated_to_id→pf_profiles(id)organization_id→pf_organizations(id)request_id→fw_approval_requests(id)step_id→fw_approval_steps(id)updated_by→pf_profiles(id)
fw_approval_assignments_delete(DELETE)fw_approval_assignments_insert(INSERT)fw_approval_assignments_select(SELECT)fw_approval_assignments_update(UPDATE)
fw_approval_chains
RLS: ✅ enabled (4 policies)
Foreign keys:
automation_rule_id→fw_automation_rules(id)created_by→pf_profiles(id)organization_id→pf_organizations(id)site_id→pf_sites(id)template_id→pf_approval_chain_templates(id)updated_by→pf_profiles(id)
fw_approval_chains_delete(DELETE)fw_approval_chains_insert(INSERT)fw_approval_chains_select(SELECT)fw_approval_chains_update(UPDATE)
fw_approval_delegations
RLS: ✅ enabled (4 policies)
Foreign keys:
created_by→pf_profiles(id)delegatee_id→pf_profiles(id)delegator_id→pf_profiles(id)organization_id→pf_organizations(id)
fw_approval_delegations_delete(DELETE)fw_approval_delegations_insert(INSERT)fw_approval_delegations_select(SELECT)fw_approval_delegations_update(UPDATE)
fw_approval_history
RLS: ✅ enabled (2 policies)
Foreign keys:
actor_id→pf_profiles(id)assignment_id→fw_approval_assignments(id)organization_id→pf_organizations(id)request_id→fw_approval_requests(id)step_id→fw_approval_steps(id)
fw_approval_history_insert(INSERT)fw_approval_history_select(SELECT)
fw_approval_requests
RLS: ✅ enabled (4 policies)
Foreign keys:
chain_id→fw_approval_chains(id)completed_by→pf_profiles(id)created_by→pf_profiles(id)organization_id→pf_organizations(id)routing_decision_table_id→fw_decision_tables(id)routing_rule_id→fw_approval_routing_rules(id)site_id→pf_sites(id)submitted_by→pf_profiles(id)updated_by→pf_profiles(id)
fw_approval_requests_delete(DELETE)fw_approval_requests_insert(INSERT)fw_approval_requests_select(SELECT)fw_approval_requests_update(UPDATE)
fw_approval_routing_rules
FW-54: Per-entity-type approval chain routing rules (FW-17 conditions or FW-45 decision table). First-match by priority.
RLS: ✅ enabled (4 policies)
Foreign keys:
created_by→pf_profiles(id)decision_table_id→fw_decision_tables(id)organization_id→pf_organizations(id)site_id→pf_sites(id)target_chain_id→fw_approval_chains(id)updated_by→pf_profiles(id)
fw_approval_routing_rules_delete(DELETE)fw_approval_routing_rules_insert(INSERT)fw_approval_routing_rules_select(SELECT)fw_approval_routing_rules_update(UPDATE)
fw_approval_steps
RLS: ✅ enabled (4 policies)
Foreign keys:
chain_id→fw_approval_chains(id)created_by→pf_profiles(id)organization_id→pf_organizations(id)updated_by→pf_profiles(id)
fw_approval_steps_delete(DELETE)fw_approval_steps_insert(INSERT)fw_approval_steps_select(SELECT)fw_approval_steps_update(UPDATE)
fw_automation_actions
RLS: ✅ enabled (4 policies)
Foreign keys:
rule_id→fw_automation_rules(id)
Users can view automation actions(SELECT)fw_automation_actions_delete(DELETE)fw_automation_actions_insert(INSERT)fw_automation_actions_update(UPDATE)
fw_automation_logs
RLS: ✅ enabled (1 policies)
Foreign keys:
rule_id→fw_automation_rules(id)triggered_by→pf_profiles(id)
Users can view automation logs(SELECT)
fw_automation_rules
RLS: ✅ enabled (5 policies)
Foreign keys:
approved_by→pf_profiles(id)created_by→pf_profiles(id)organization_id→pf_organizations(id)site_id→pf_sites(id)updated_by→users(id)
Users can create automation rules(INSERT)Users can delete automation rules(DELETE)Users can update automation rules(UPDATE)Users can view automation rules(SELECT)fw_automation_rules_update(UPDATE)
fw_business_calendars
FW-35: Business calendars defining working hours and timezone per organization.
RLS: ✅ enabled (4 policies)
Foreign keys:
created_by→pf_profiles(id)organization_id→pf_organizations(id)updated_by→pf_profiles(id)
business_calendars_delete(DELETE)business_calendars_insert(INSERT)business_calendars_select(SELECT)business_calendars_update(UPDATE)
fw_calendar_holidays
FW-35: Holidays/closures for business calendars. Dates excluded from business hours calculations.
RLS: ✅ enabled (4 policies)
Foreign keys:
calendar_id→fw_business_calendars(id)organization_id→pf_organizations(id)
calendar_holidays_delete(DELETE)calendar_holidays_insert(INSERT)calendar_holidays_select(SELECT)calendar_holidays_update(UPDATE)
fw_compliance_audit_entries
FW-43: Formal compliance audit records for regulatory reporting. Immutable — no UPDATE/DELETE.
RLS: ✅ enabled (1 policies)
Foreign keys:
actor_id→pf_profiles(id)organization_id→pf_organizations(id)
org_select_compliance_audit(SELECT)
fw_dead_letter_queue
FW-47: Dead Letter Queue for failed automation executions. Stores permanently failed messages for admin triage, retry, or discard.
RLS: ✅ enabled (3 policies)
Foreign keys:
created_by→pf_profiles(id)organization_id→pf_organizations(id)resolved_by→pf_profiles(id)retry_execution_id→fw_workflow_executions(id)updated_by→pf_profiles(id)
fw_dlq_insert(INSERT)fw_dlq_select(SELECT)fw_dlq_update(UPDATE)
fw_debug_sessions
Tracks active debug sessions for step-through debugging
RLS: ✅ enabled (4 policies)
Foreign keys:
created_by→pf_profiles(id)debug_user_id→pf_profiles(id)execution_id→fw_workflow_executions(id)organization_id→pf_organizations(id)site_id→pf_sites(id)updated_by→pf_profiles(id)
fw_debug_sessions_delete(DELETE)fw_debug_sessions_insert(INSERT)fw_debug_sessions_select(SELECT)fw_debug_sessions_update(UPDATE)
fw_decision_table_versions
FW-45: Immutable version snapshots of decision tables created on publish.
RLS: ✅ enabled (4 policies)
Foreign keys:
decision_table_id→fw_decision_tables(id)organization_id→pf_organizations(id)published_by→pf_profiles(id)
decision_table_versions_delete_deny(DELETE)decision_table_versions_insert(INSERT)decision_table_versions_select(SELECT)decision_table_versions_update_deny(UPDATE)
fw_decision_tables
FW-45: Configurable decision tables for workflow and rule evaluation use cases.
RLS: ✅ enabled (4 policies)
Foreign keys:
created_by→pf_profiles(id)organization_id→pf_organizations(id)updated_by→pf_profiles(id)
decision_tables_delete(DELETE)decision_tables_insert(INSERT)decision_tables_select(SELECT)decision_tables_update(UPDATE)
fw_dependency_graph
FW-55: Normalized edge store for inter-entity dependencies (forms, workflows, automations, decision tables, events, lookups)
RLS: ✅ enabled (4 policies)
Foreign keys:
created_by→pf_profiles(id)organization_id→pf_organizations(id)updated_by→pf_profiles(id)
fw_dependency_graph_delete(DELETE)fw_dependency_graph_insert(INSERT)fw_dependency_graph_select(SELECT)fw_dependency_graph_update(UPDATE)
fw_domain_events
RLS: ✅ enabled (2 policies)
Foreign keys:
organization_id→pf_organizations(id)site_id→pf_sites(id)
fw_domain_events_insert(INSERT)fw_domain_events_select(SELECT)
fw_execution_logs
Detailed execution logs for workflow monitoring and debugging
RLS: ✅ enabled (3 policies)
Foreign keys:
created_by→pf_profiles(id)execution_id→fw_workflow_executions(id)organization_id→pf_organizations(id)site_id→pf_sites(id)updated_by→users(id)
fw_execution_logs_delete(DELETE)fw_execution_logs_insert(INSERT)fw_execution_logs_select(SELECT)
fw_execution_rate_counters
FW-53: Rolling execution counters for rate limiting; TTL cleanup via scheduled job.
RLS: ✅ enabled (1 policies)
Foreign keys:
organization_id→pf_organizations(id)workflow_definition_id→fw_workflow_definitions(id)
fw_execution_rate_counters_select(SELECT)
fw_execution_steps
FW-48: Step-level checkpoint persistence for workflow executions.
RLS: ✅ enabled (4 policies)
Foreign keys:
created_by→pf_profiles(id)execution_id→fw_workflow_executions(id)organization_id→pf_organizations(id)updated_by→pf_profiles(id)
execution_steps_delete(DELETE)execution_steps_insert(INSERT)execution_steps_select(SELECT)execution_steps_update(UPDATE)
fw_form_fields
RLS: ✅ enabled (5 policies)
Foreign keys:
form_id→fw_forms(id)organization_id→pf_organizations(id)
Users can view form fields(SELECT)fw_form_fields_delete(DELETE)fw_form_fields_insert(INSERT)fw_form_fields_select(SELECT)fw_form_fields_update(UPDATE)
fw_form_permissions
FW-01: Granular form access control (user-level and role-level)
RLS: ✅ enabled (4 policies)
Foreign keys:
form_id→fw_forms(id)user_id→pf_profiles(id)
Users can view form permissions(SELECT)fw_form_permissions_delete(DELETE)fw_form_permissions_insert(INSERT)fw_form_permissions_update(UPDATE)
fw_form_portal_config
RLS: ✅ enabled (4 policies)
Foreign keys:
created_by→pf_profiles(id)form_id→fw_forms(id)organization_id→pf_organizations(id)updated_by→pf_profiles(id)
fw_portal_config_delete(DELETE)fw_portal_config_insert(INSERT)fw_portal_config_select(SELECT)fw_portal_config_update(UPDATE)
fw_form_prefill_rules
FW-60: Per-field prefill rules for forms (org-scoped; no PHI in config).
RLS: ✅ enabled (4 policies)
Foreign keys:
created_by→pf_profiles(id)field_id→fw_form_fields(id)form_id→fw_forms(id)organization_id→pf_organizations(id)updated_by→pf_profiles(id)
fw_form_prefill_rules_delete(DELETE)fw_form_prefill_rules_insert(INSERT)fw_form_prefill_rules_select(SELECT)fw_form_prefill_rules_update(UPDATE)
fw_form_submission_signatures
RLS: ✅ enabled (2 policies)
Foreign keys:
field_id→fw_form_fields(id)organization_id→pf_organizations(id)signature_id→pf_signatures(id)site_id→pf_sites(id)submission_id→fw_form_submissions(id)
fw_form_sub_sig_insert(INSERT)fw_form_sub_sig_select(SELECT)
fw_form_submissions
RLS: ✅ enabled (4 policies)
Foreign keys:
form_id→fw_forms(id)organization_id→pf_organizations(id)reviewed_by→pf_profiles(id)signed_document_id→pf_documents(id)submitted_by→pf_profiles(id)
fw_form_submissions_delete(DELETE)fw_form_submissions_insert(INSERT)fw_form_submissions_select(SELECT)fw_form_submissions_update(UPDATE)
fw_form_template_ratings
FW-28: Ratings and reviews for marketplace form templates
RLS: ✅ enabled (4 policies)
Foreign keys:
created_by→pf_profiles(id)organization_id→pf_organizations(id)template_id→fw_form_templates(id)updated_by→pf_profiles(id)
fw_form_template_ratings_delete(DELETE)fw_form_template_ratings_insert(INSERT)fw_form_template_ratings_select(SELECT)fw_form_template_ratings_update(UPDATE)
fw_form_templates
FW-28: Form template library for reusable form definitions
RLS: ✅ enabled (6 policies)
Foreign keys:
created_by→pf_profiles(id)linked_workflow_template_id→fw_workflow_templates(id)organization_id→pf_organizations(id)source_form_id→fw_forms(id)updated_by→pf_profiles(id)
fw_form_templates_delete(DELETE)fw_form_templates_insert(INSERT)fw_form_templates_select(SELECT)fw_form_templates_system_immutable_delete(DELETE)fw_form_templates_system_immutable_update(UPDATE)fw_form_templates_update(UPDATE)
fw_form_versions
FW-01: Stores form version history for compliance and rollback
RLS: ✅ enabled (4 policies)
Foreign keys:
form_id→fw_forms(id)organization_id→pf_organizations(id)published_by→pf_profiles(id)
Users can create form versions(INSERT)Users can view form versions(SELECT)fw_form_versions_insert(INSERT)fw_form_versions_select(SELECT)
fw_forms
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)
Users with org access can create forms(INSERT)Users with org access can update forms(UPDATE)Users with org access can view forms(SELECT)
fw_kpi_configurations
FW-58: Tenant-scoped KPI metric configurations for the workflow dashboard
RLS: ✅ enabled (4 policies)
Foreign keys:
created_by→pf_profiles(id)organization_id→pf_organizations(id)updated_by→pf_profiles(id)
fw_kpi_configurations_delete(DELETE)fw_kpi_configurations_insert(INSERT)fw_kpi_configurations_select(SELECT)fw_kpi_configurations_update(UPDATE)
fw_kpi_report_schedules
FW-58: Scheduled KPI report delivery configurations. Recipients must be org profile emails.
RLS: ✅ enabled (4 policies)
Foreign keys:
created_by→pf_profiles(id)organization_id→pf_organizations(id)updated_by→pf_profiles(id)
fw_kpi_report_schedules_delete(DELETE)fw_kpi_report_schedules_insert(INSERT)fw_kpi_report_schedules_select(SELECT)fw_kpi_report_schedules_update(UPDATE)
fw_kpi_snapshots
FW-58: Precomputed KPI metric snapshots for responsive dashboard reads. Writes via fw_upsert_kpi_snapshot only.
RLS: ✅ enabled (1 policies)
Foreign keys:
config_id→fw_kpi_configurations(id)organization_id→pf_organizations(id)
fw_kpi_snapshots_select(SELECT)
fw_module_settings
FW-CONST: Organization-level configuration for Forms & Workflow module
RLS: ✅ enabled (4 policies)
Foreign keys:
created_by→pf_profiles(id)organization_id→pf_organizations(id)updated_by→pf_profiles(id)
fw_module_settings_delete(DELETE)fw_module_settings_insert(INSERT)fw_module_settings_select(SELECT)fw_module_settings_update(UPDATE)
fw_page_templates
FW-05 Phase 3: Reusable page templates for multi-page forms
RLS: ✅ enabled (4 policies)
Foreign keys:
created_by→pf_profiles(id)organization_id→pf_organizations(id)updated_by→pf_profiles(id)
fw_page_templates_delete(DELETE)fw_page_templates_insert(INSERT)fw_page_templates_select(SELECT)fw_page_templates_update(UPDATE)
fw_portal_rate_limits
RLS: ✅ enabled (4 policies)
Foreign keys:
form_id→fw_forms(id)
fw_portal_rate_limits_select(SELECT)fw_portal_rate_limits_system_delete(DELETE)fw_portal_rate_limits_system_manage(INSERT)fw_portal_rate_limits_system_update(UPDATE)
fw_portal_submissions
RLS: ✅ enabled (3 policies)
Foreign keys:
organization_id→pf_organizations(id)portal_config_id→fw_form_portal_config(id)submission_id→fw_form_submissions(id)
fw_portal_submissions_delete(DELETE)fw_portal_submissions_select(SELECT)fw_portal_submissions_update(UPDATE)
fw_query_whitelist
RLS: ✅ enabled (4 policies)
Foreign keys:
created_by→pf_profiles(id)organization_id→pf_organizations(id)updated_by→pf_profiles(id)
fw_query_whitelist_delete(DELETE)fw_query_whitelist_insert(INSERT)fw_query_whitelist_select(SELECT)fw_query_whitelist_update(UPDATE)
fw_rate_limit_configs
FW-53: Org/workflow/trigger scoped workflow execution rate limits and debounce configuration.
RLS: ✅ enabled (4 policies)
Foreign keys:
automation_rule_id→fw_automation_rules(id)created_by→pf_profiles(id)organization_id→pf_organizations(id)updated_by→pf_profiles(id)workflow_definition_id→fw_workflow_definitions(id)
fw_rate_limit_configs_delete(DELETE)fw_rate_limit_configs_insert(INSERT)fw_rate_limit_configs_select(SELECT)fw_rate_limit_configs_update(UPDATE)
fw_regulatory_change_log
FW-57: Org-scoped operational regulatory change tracking for templates (not legal records). Do not store PHI in free-text fields.
RLS: ✅ enabled (4 policies)
Foreign keys:
created_by→pf_profiles(id)organization_id→pf_organizations(id)reviewed_by→pf_profiles(id)template_id→fw_workflow_templates(id)updated_by→pf_profiles(id)
fw_regulatory_change_log_delete(DELETE)fw_regulatory_change_log_insert(INSERT)fw_regulatory_change_log_select(SELECT)fw_regulatory_change_log_update(UPDATE)
fw_rule_evaluations
FW-45: Append-only audit log of decision table evaluations from server-side contexts.
RLS: ✅ enabled (4 policies)
Foreign keys:
decision_table_id→fw_decision_tables(id)evaluated_by→pf_profiles(id)organization_id→pf_organizations(id)version_id→fw_decision_table_versions(id)
rule_evaluations_delete_deny(DELETE)rule_evaluations_insert(INSERT)rule_evaluations_select(SELECT)rule_evaluations_update_deny(UPDATE)
fw_sandbox_executions
FW-24: Sandbox execution records for workflow testing
RLS: ✅ enabled (4 policies)
Foreign keys:
created_by→users(id)forked_from_execution_id→fw_workflow_executions(id)forked_from_step_id→fw_execution_steps(id)organization_id→pf_organizations(id)rule_id→fw_automation_rules(id)scenario_id→fw_test_scenarios(id)site_id→pf_sites(id)test_case_id→fw_test_cases(id)
fw_sandbox_executions_delete(DELETE)fw_sandbox_executions_insert_org_members(INSERT)fw_sandbox_executions_select_org_members(SELECT)fw_sandbox_executions_update_creator(UPDATE)
fw_signature_audit_log
RLS: ✅ enabled (2 policies)
Foreign keys:
actor_user_id→pf_profiles(id)organization_id→pf_organizations(id)submission_signature_id→fw_form_submission_signatures(id)
fw_signature_audit_insert_system(INSERT)fw_signature_audit_select(SELECT)
fw_subflows
RLS: ✅ enabled (4 policies)
Foreign keys:
created_by→pf_profiles(id)organization_id→pf_organizations(id)updated_by→pf_profiles(id)
subflows_org_delete(DELETE)subflows_org_insert(INSERT)subflows_org_select(SELECT)subflows_org_update(UPDATE)
fw_submission_attachments
Uses submission-attachments storage bucket
RLS: ✅ enabled (3 policies)
Foreign keys:
submission_id→fw_form_submissions(id)uploaded_by→pf_profiles(id)
Users can delete own attachments(DELETE)Users can upload submission attachments(INSERT)Users can view submission attachments(SELECT)
fw_submission_notes
RLS: ✅ enabled (4 policies)
Foreign keys:
created_by→pf_profiles(id)submission_id→fw_form_submissions(id)updated_by→users(id)
Users can create submission notes(INSERT)Users can delete own notes(DELETE)Users can update own notes(UPDATE)Users can view submission notes(SELECT)
fw_submission_sections
PF-08-EN WS3: Tracks independent section completions for multi-submitter forms (e.g., I-9 Section 1 by employee, Section 2 by employer).
RLS: ✅ enabled (4 policies)
Foreign keys:
created_by→users(id)organization_id→pf_organizations(id)submission_id→fw_form_submissions(id)submitted_by→users(id)updated_by→users(id)
fw_submission_sections_delete(DELETE)fw_submission_sections_insert(INSERT)fw_submission_sections_select(SELECT)fw_submission_sections_update(UPDATE)
fw_template_update_notifications
FW-28: Tracks template update notifications for derived workflows
RLS: ✅ enabled (4 policies)
Foreign keys:
notified_user_id→pf_profiles(id)organization_id→pf_organizations(id)template_id→fw_workflow_templates(id)workflow_id→fw_automation_rules(id)
fw_template_update_notifications_delete(DELETE)fw_template_update_notifications_insert(INSERT)fw_template_update_notifications_select(SELECT)fw_template_update_notifications_update(UPDATE)
fw_test_cases
FW-24: Automated test case definitions for workflow testing
RLS: ✅ enabled (4 policies)
Foreign keys:
created_by→pf_profiles(id)last_run_execution_id→fw_sandbox_executions(id)organization_id→pf_organizations(id)rule_id→fw_automation_rules(id)site_id→pf_sites(id)test_dataset_id→fw_test_datasets(id)updated_by→pf_profiles(id)
fw_test_cases_delete(DELETE)fw_test_cases_insert(INSERT)fw_test_cases_select(SELECT)fw_test_cases_update(UPDATE)
fw_test_coverage
RLS: ✅ enabled (4 policies)
Foreign keys:
created_by→pf_profiles(id)organization_id→pf_organizations(id)rule_id→fw_automation_rules(id)site_id→pf_sites(id)updated_by→pf_profiles(id)
fw_test_coverage_delete(DELETE)fw_test_coverage_insert(INSERT)fw_test_coverage_select(SELECT)fw_test_coverage_update(UPDATE)
fw_test_datasets
RLS: ✅ enabled (4 policies)
Foreign keys:
created_by→pf_profiles(id)organization_id→pf_organizations(id)parent_dataset_id→fw_test_datasets(id)site_id→pf_sites(id)updated_by→pf_profiles(id)
Users can create test datasets in their org(INSERT)Users can delete test datasets in their org(DELETE)Users can update test datasets in their org(UPDATE)Users can view test datasets in their org(SELECT)
fw_test_scenarios
RLS: ✅ enabled (4 policies)
Foreign keys:
created_by→pf_profiles(id)organization_id→pf_organizations(id)rule_id→fw_automation_rules(id)site_id→pf_sites(id)test_dataset_id→fw_test_datasets(id)updated_by→pf_profiles(id)
Users can create test scenarios in their org(INSERT)Users can delete test scenarios in their org(DELETE)Users can update test scenarios in their org(UPDATE)Users can view test scenarios in their org(SELECT)
fw_webhook_endpoints
FW-59: Inbound webhook endpoint configurations for external system integrations.
RLS: ✅ enabled (4 policies)
Foreign keys:
created_by→users(id)organization_id→pf_organizations(id)updated_by→users(id)workflow_definition_id→fw_workflow_definitions(id)
fw_webhook_endpoints_delete(DELETE)fw_webhook_endpoints_insert(INSERT)fw_webhook_endpoints_select(SELECT)fw_webhook_endpoints_update(UPDATE)
fw_webhook_logs
FW-59: Audit log for inbound webhook requests. Stores encrypted request bodies for replay.
RLS: ✅ enabled (3 policies)
Foreign keys:
endpoint_id→fw_webhook_endpoints(id)organization_id→pf_organizations(id)replay_of→fw_webhook_logs(id)
fw_webhook_logs_select(SELECT)fw_webhook_logs_service_insert(INSERT)fw_webhook_logs_service_update(UPDATE)
fw_webhook_secrets
FW-59: Hashed webhook signing secrets. No direct organization_id; tenant isolation via FK chain to fw_webhook_endpoints. See spec Pattern Exception.
RLS: ✅ enabled (4 policies)
Foreign keys:
created_by→users(id)endpoint_id→fw_webhook_endpoints(id)
fw_webhook_secrets_delete(DELETE)fw_webhook_secrets_insert(INSERT)fw_webhook_secrets_select(SELECT)fw_webhook_secrets_update(UPDATE)
fw_workflow_alert_rules
RLS: ✅ enabled (4 policies)
Foreign keys:
created_by→pf_profiles(id)organization_id→pf_organizations(id)rule_id→fw_automation_rules(id)site_id→pf_sites(id)updated_by→pf_profiles(id)
alert_rules_delete(DELETE)alert_rules_insert(INSERT)alert_rules_select(SELECT)alert_rules_update(UPDATE)
fw_workflow_alerts
RLS: ✅ enabled (3 policies)
Foreign keys:
acknowledged_by→pf_profiles(id)alert_rule_id→fw_workflow_alert_rules(id)execution_id→fw_workflow_executions(id)organization_id→pf_organizations(id)resolved_by→pf_profiles(id)rule_id→fw_automation_rules(id)site_id→pf_sites(id)
fw_workflow_alerts_insert(INSERT)workflow_alerts_select(SELECT)workflow_alerts_update(UPDATE)
fw_workflow_approvals
RLS: ✅ enabled (4 policies)
Foreign keys:
assignee_user_id→pf_profiles(id)decided_by→pf_profiles(id)execution_id→fw_workflow_executions(id)organization_id→pf_organizations(id)
workflow_approvals_assignee_update(UPDATE)workflow_approvals_org_delete(DELETE)workflow_approvals_org_insert(INSERT)workflow_approvals_org_select(SELECT)
fw_workflow_audit_events
FW-43: Immutable audit log of workflow execution lifecycle events. No UPDATE/DELETE allowed.
RLS: ✅ enabled (1 policies)
Foreign keys:
execution_id→fw_workflow_executions(id)organization_id→pf_organizations(id)
fw_audit_events_select(SELECT)
fw_workflow_audit_events_p202604
RLS: ✅ enabled
fw_workflow_audit_events_p202605
RLS: ✅ enabled
fw_workflow_audit_events_p202606
RLS: ✅ enabled
fw_workflow_audit_events_p202607
RLS: ✅ enabled
fw_workflow_audit_events_p202608
RLS: ✅ enabled
fw_workflow_audit_events_p202609
RLS: ✅ enabled
fw_workflow_audit_events_p202610
RLS: ✅ enabled
fw_workflow_audit_events_p202611
RLS: ✅ enabled
fw_workflow_audit_events_pdefault
RLS: ✅ enabled
fw_workflow_best_practices
FW-30: System-wide workflow best practice definitions
RLS: ✅ enabled (4 policies)
Policies:
fw_best_practices_delete(DELETE)fw_best_practices_insert(INSERT)fw_best_practices_select(SELECT)fw_best_practices_update(UPDATE)
fw_workflow_circuit_breakers
FW-25: Per-node circuit breaker state for workflow automation rules
RLS: ✅ enabled (4 policies)
Foreign keys:
created_by→pf_profiles(id)organization_id→pf_organizations(id)rule_id→fw_automation_rules(id)site_id→pf_sites(id)updated_by→pf_profiles(id)
fw_circuit_breakers_delete(DELETE)fw_circuit_breakers_insert(INSERT)fw_circuit_breakers_select(SELECT)fw_circuit_breakers_update(UPDATE)
fw_workflow_compensation_actions
FW-25: Compensation action definitions for workflow automation rules
RLS: ✅ enabled (4 policies)
Foreign keys:
created_by→pf_profiles(id)organization_id→pf_organizations(id)rule_id→fw_automation_rules(id)site_id→pf_sites(id)updated_by→pf_profiles(id)
fw_compensation_actions_delete(DELETE)fw_compensation_actions_insert(INSERT)fw_compensation_actions_select(SELECT)fw_compensation_actions_update(UPDATE)
fw_workflow_compliance_scores
FW-30: Workflow compliance scores against best practices
RLS: ✅ enabled (4 policies)
Foreign keys:
created_by→users(id)organization_id→pf_organizations(id)rule_id→fw_automation_rules(id)updated_by→users(id)
fw_compliance_scores_delete(DELETE)fw_compliance_scores_insert(INSERT)fw_compliance_scores_select(SELECT)fw_compliance_scores_update(UPDATE)
fw_workflow_definitions
RLS: ✅ enabled (4 policies)
Foreign keys:
created_by→pf_profiles(id)organization_id→pf_organizations(id)rule_id→fw_automation_rules(id)updated_by→pf_profiles(id)
workflow_definitions_org_delete(DELETE)workflow_definitions_org_insert(INSERT)workflow_definitions_org_select(SELECT)workflow_definitions_org_update(UPDATE)
fw_workflow_events
Registry of all domain events published via pg_notify. Events registered here can be consumed by edge functions and other services.
RLS: ✅ enabled (1 policies)
Policies:
Authenticated users can view workflow events(SELECT)
fw_workflow_executions
RLS: ✅ enabled (4 policies)
Foreign keys:
log_id→fw_automation_logs(id)organization_id→pf_organizations(id)parent_execution_id→fw_workflow_executions(id)replay_of_id→fw_workflow_executions(id)rule_id→fw_automation_rules(id)
workflow_executions_org_delete(DELETE)workflow_executions_org_insert(INSERT)workflow_executions_org_select(SELECT)workflow_executions_org_update(UPDATE)
fw_workflow_executions_p202604
RLS: ✅ enabled
fw_workflow_executions_p202605
RLS: ✅ enabled
fw_workflow_executions_p202606
RLS: ✅ enabled
fw_workflow_executions_p202607
RLS: ✅ enabled
fw_workflow_executions_p202608
RLS: ✅ enabled
fw_workflow_executions_p202609
RLS: ✅ enabled
fw_workflow_executions_p202610
RLS: ✅ enabled
fw_workflow_executions_p202611
RLS: ✅ enabled
fw_workflow_executions_pdefault
RLS: ✅ enabled
fw_workflow_notification_preferences
RLS: ✅ enabled (4 policies)
Foreign keys:
organization_id→pf_organizations(id)site_id→pf_sites(id)user_id→pf_profiles(id)
notification_preferences_delete(DELETE)notification_preferences_insert(INSERT)notification_preferences_select(SELECT)notification_preferences_update(UPDATE)
fw_workflow_notification_rules
RLS: ✅ enabled (4 policies)
Foreign keys:
created_by→pf_profiles(id)organization_id→pf_organizations(id)rule_id→fw_automation_rules(id)site_id→pf_sites(id)updated_by→pf_profiles(id)
notification_rules_delete(DELETE)notification_rules_insert(INSERT)notification_rules_select(SELECT)notification_rules_update(UPDATE)
fw_workflow_optimization_suggestions
FW-30: AI-generated workflow optimization suggestions
RLS: ✅ enabled (4 policies)
Foreign keys:
applied_by→users(id)created_by→users(id)dismissed_by→users(id)organization_id→pf_organizations(id)rule_id→fw_automation_rules(id)updated_by→users(id)
fw_optimization_suggestions_delete(DELETE)fw_optimization_suggestions_insert(INSERT)fw_optimization_suggestions_select(SELECT)fw_optimization_suggestions_update(UPDATE)
fw_workflow_path_analytics
RLS: ✅ enabled (4 policies)
Foreign keys:
created_by→pf_profiles(id)organization_id→pf_organizations(id)rule_id→fw_automation_rules(id)updated_by→pf_profiles(id)
fw_path_analytics_delete(DELETE)fw_path_analytics_insert(INSERT)fw_path_analytics_select(SELECT)fw_path_analytics_update(UPDATE)
fw_workflow_performance_metrics
RLS: ✅ enabled (4 policies)
Foreign keys:
created_by→pf_profiles(id)organization_id→pf_organizations(id)rule_id→fw_automation_rules(id)updated_by→pf_profiles(id)
fw_performance_metrics_delete(DELETE)fw_performance_metrics_insert(INSERT)fw_performance_metrics_select(SELECT)fw_performance_metrics_update(UPDATE)
fw_workflow_recovery_workflows
FW-25: Recovery workflow definitions linked to automation rules
RLS: ✅ enabled (4 policies)
Foreign keys:
created_by→pf_profiles(id)organization_id→pf_organizations(id)recovery_rule_id→fw_automation_rules(id)rule_id→fw_automation_rules(id)site_id→pf_sites(id)updated_by→pf_profiles(id)
fw_recovery_workflows_delete(DELETE)fw_recovery_workflows_insert(INSERT)fw_recovery_workflows_select(SELECT)fw_recovery_workflows_update(UPDATE)
fw_workflow_retry_configs
FW-25: Per-node retry configuration for workflow automation rules
RLS: ✅ enabled (4 policies)
Foreign keys:
created_by→pf_profiles(id)organization_id→pf_organizations(id)rule_id→fw_automation_rules(id)site_id→pf_sites(id)updated_by→pf_profiles(id)
fw_retry_configs_delete(DELETE)fw_retry_configs_insert(INSERT)fw_retry_configs_select(SELECT)fw_retry_configs_update(UPDATE)
fw_workflow_schedules
FW-26: scheduling configuration for an automation rule (cron / datetime / dependency / manual). One schedule per rule.
RLS: ✅ enabled (4 policies)
Foreign keys:
created_by→users(id)depends_on_rule_id→fw_automation_rules(id)organization_id→pf_organizations(id)rule_id→fw_automation_rules(id)updated_by→users(id)
fw_workflow_schedules_org_delete(DELETE)fw_workflow_schedules_org_insert(INSERT)fw_workflow_schedules_org_select(SELECT)fw_workflow_schedules_org_update(UPDATE)
fw_workflow_template_ratings
FW-28: Ratings and reviews for workflow templates
RLS: ✅ enabled (4 policies)
Foreign keys:
created_by→pf_profiles(id)organization_id→pf_organizations(id)template_id→fw_workflow_templates(id)updated_by→pf_profiles(id)
fw_workflow_template_ratings_delete(DELETE)fw_workflow_template_ratings_insert(INSERT)fw_workflow_template_ratings_select(SELECT)fw_workflow_template_ratings_update(UPDATE)
fw_workflow_template_usage
FW-28: Tracks usage of workflow templates
RLS: ✅ enabled (4 policies)
Foreign keys:
organization_id→pf_organizations(id)template_id→fw_workflow_templates(id)used_by→pf_profiles(id)
fw_workflow_template_usage_delete(DELETE)fw_workflow_template_usage_insert(INSERT)fw_workflow_template_usage_select(SELECT)fw_workflow_template_usage_update(UPDATE)
fw_workflow_template_versions
RLS: ✅ enabled (3 policies)
Foreign keys:
organization_id→pf_organizations(id)published_by→pf_profiles(id)template_id→fw_workflow_templates(id)
fw_template_versions_delete(DELETE)fw_template_versions_insert(INSERT)fw_template_versions_select(SELECT)
fw_workflow_templates
FW-28: Workflow templates for reuse and marketplace sharing
RLS: ✅ enabled (6 policies)
Foreign keys:
created_by→pf_profiles(id)organization_id→pf_organizations(id)source_template_id→fw_workflow_templates(id)updated_by→pf_profiles(id)
fw_workflow_templates_delete(DELETE)fw_workflow_templates_insert(INSERT)fw_workflow_templates_select(SELECT)fw_workflow_templates_system_immutable_delete(DELETE)fw_workflow_templates_system_immutable_update(UPDATE)fw_workflow_templates_update(UPDATE)
fw_workflow_version_comparisons
RLS: ✅ enabled (4 policies)
Foreign keys:
created_by→users(id)organization_id→pf_organizations(id)rule_id→fw_automation_rules(id)updated_by→users(id)
fw_version_comparisons_delete_admin(DELETE)fw_version_comparisons_insert_admin(INSERT)fw_version_comparisons_select(SELECT)fw_version_comparisons_update_admin(UPDATE)
fw_workflow_versions
RLS: ✅ enabled (2 policies)
Foreign keys:
organization_id→pf_organizations(id)published_by→pf_profiles(id)rule_id→fw_automation_rules(id)
workflow_versions_org_insert(INSERT)workflow_versions_org_select(SELECT)