Skip to main content

Overview

PF-83 introduced two new tables and extended pf_module_settings with SLA-related configuration columns. The migration was applied via the Supabase MCP execute_sql tool — no .sql file exists on disk in supabase/migrations/.

Tables Created

pf_sla_definitions (20 columns)

pf_sla_instances (21 columns)

RLS Policies

Both tables have RLS enabled with policies using the pf_has_org_access(organization_id) SECURITY DEFINER function:
  • SELECT: Authenticated users with org access
  • INSERT: Authenticated users with org access
  • UPDATE: Authenticated users with org access, WITH CHECK clause
  • DELETE: Authenticated users with org access

Settings Columns Added to pf_module_settings

SLA-related configuration is stored in the existing pf_module_settings table via its custom_fields JSONB column. No new columns were added to the table schema.

Rollback Procedure

To remove PF-83 tables (destructive — all SLA data will be lost):
Warning: This is irreversible. Back up data before executing.

Notes

  • No .sql migration file on disk — The migration was applied directly via Supabase MCP execute_sql. This is a known limitation of the Lovable workflow. The schema is in the live database and reflected in types.ts.
  • PF-84 dependency — Business calendar-aware deadline calculation is deferred until PF-84 is implemented. Current deadlines use simple interval math.
  • Edge function pf-sla-checker — Deferred to Phase 2. Will provide server-side periodic breach detection.

References