-- 074_engagement_columns.sql
-- Store client engagement authorization consent for compliance orders.
-- Part 1: clickwrap checkbox consent for all orders.
-- Part 2: eSign engagement letter for 499-A past-due/multi-year refiling.

ALTER TABLE compliance_orders
  ADD COLUMN IF NOT EXISTS engagement_accepted_at   TIMESTAMPTZ,
  ADD COLUMN IF NOT EXISTS engagement_accepted_ip   TEXT,
  ADD COLUMN IF NOT EXISTS engagement_version       TEXT,
  ADD COLUMN IF NOT EXISTS engagement_esign_required BOOLEAN DEFAULT FALSE,
  ADD COLUMN IF NOT EXISTS engagement_esign_signed_at TIMESTAMPTZ,
  ADD COLUMN IF NOT EXISTS engagement_letter_minio_key TEXT;
