-- 003_policy_rationale.sql
-- Add policy rationale column to findings_projection (LEDGER-29-004)

BEGIN;

ALTER TABLE findings_projection
    ADD COLUMN IF NOT EXISTS policy_rationale JSONB NOT NULL DEFAULT '[]'::JSONB;

ALTER TABLE findings_projection
    ALTER COLUMN policy_rationale SET DEFAULT '[]'::JSONB;

UPDATE findings_projection
   SET policy_rationale = '[]'::JSONB
 WHERE policy_rationale IS NULL;

COMMIT;
