-- Migration: Online attendance — device / mode capture
-- Description: Adds the join-time client metadata (mode of joining, device type,
--              device info) to program_user_attendance. Captured on join-click and
--              merged into hdb_zoom_analytics during reconciliation so analytics can
--              report platform/mode breakdowns (parity with the serverless webinar
--              product). All nullable — historical rows stay valid.
-- Idempotent — safe to re-run.

ALTER TABLE program_user_attendance
  ADD COLUMN IF NOT EXISTS mode_of_joining VARCHAR(50),
  ADD COLUMN IF NOT EXISTS device_type     VARCHAR(100),
  ADD COLUMN IF NOT EXISTS device_info     VARCHAR(255);

COMMENT ON COLUMN program_user_attendance.mode_of_joining IS 'How the participant joined: SELF | JOINING_WITH_OTHERS | JOINING_ON_OTHER_DEVICE';
COMMENT ON COLUMN program_user_attendance.device_type IS 'Client used to join: App | Browser | ThroughLink';
COMMENT ON COLUMN program_user_attendance.device_info IS 'Free-form client detail (e.g. ios / android / user-agent)';
