Files
certctl/migrations/000026_renewal_policy_channel_matrix.up.sql
T
shankar0123 75097909e9
2026-05-05 18:18:29 +00:00

24 lines
1.2 KiB
SQL

-- Rank 4 of the 2026-05-03 Infisical deep-research deliverable
-- (the project's deep-research deliverable, Part 5). Adds the
-- per-policy channel matrix that the multi-channel expiry-alert
-- routing reads from. Two JSONB columns:
--
-- alert_channels — map[severity_tier][]channel_name. Default
-- is '{}' so the runtime falls through to
-- domain.DefaultAlertChannels() (Email-only
-- across all tiers, the back-compat
-- behaviour).
-- alert_severity_map — map[threshold_days]severity_tier. Default
-- is '{}' so the runtime falls through to
-- domain.DefaultAlertSeverityMap() (the
-- canonical 30/14/7/0 → informational/warning/
-- warning/critical mapping).
--
-- Both columns use IF NOT EXISTS so the migration is idempotent —
-- safe to re-run on every certctl-server boot per the
-- the project's "Idempotent migrations" architecture decision.
ALTER TABLE renewal_policies
ADD COLUMN IF NOT EXISTS alert_channels JSONB NOT NULL DEFAULT '{}'::jsonb,
ADD COLUMN IF NOT EXISTS alert_severity_map JSONB NOT NULL DEFAULT '{}'::jsonb;