The whistleblower pivot
The single most useful key to the schema: the codebase was forked from a generic
whistleblower / compliance-reporting platform and pivoted into a Portuguese disciplinary-
process engine. Migration 20260228135542 is literally "the big pivot". Understanding
this explains dozens of otherwise-baffling names and leftovers.
What the pivot did
- Renamed
whistleblower_email→employee_email,is_from_whistleblower→is_from_employee(oncase_messages,case_attachments). - Dropped
categories,category_id,severity(whistleblowing taxonomy). - Migrated legacy roles:
company_admin→hr_admin,case_handler→case_manager,viewer→case_manager; changed the default role. - Rewrote most RLS policies
TO authenticated(closing anon holes from the WB era).
Leftovers that still leak (rebuild must decide keep/drop for each)
cases.access_password TEXT NOT NULL— the WB case-access password, still required (plaintext access_password).SITE_NAME = "open-whisper-hub"inauth-email-hook— leaks into emailFrom:names.- English
PRESET_CATEGORIESseeded bysetup-company(Fraud, Harassment, Corruption, Retaliation…) — a whistleblowing taxonomy in a Portuguese disciplinary product. - Legacy
app_rolevalues (company_admin,case_handler,viewer) and legacycase_statusvalues that can't be dropped from the PG enums (status generations). .testsample domains andopen-whisper-hub.lovable.appplaceholders in email templates.
Rebuild implication
Use the pivot as a checklist: for every whistleblower-era artifact, decide explicitly keep, rename, or drop. Don't carry vestigial names into a clean domain model. Normalise the enums.