-- Migration: Zoom analytics — capture leave reason on live events
-- Description: Zoom's meeting/webinar participant_left webhook carries
--              participant.leave_reason ("left the meeting", "removed by the host",
--              network errors, ...). Captured per leave event so Drop-off Analysis has
--              a reason source even when the Dashboard/Metrics API isn't available on
--              the account's plan. Nullable — join events and historical rows stay valid.
-- Idempotent — safe to re-run.

ALTER TABLE zoom_analytics_live_event
  ADD COLUMN IF NOT EXISTS leave_reason VARCHAR(512);

COMMENT ON COLUMN zoom_analytics_live_event.leave_reason IS 'Zoom-reported reason a LEFT event happened (null for joins/corrections)';
