-- One-time fix: legacy approved leave wrote status=leave on Saturday/Sunday.
-- Weekends are company holidays and must not show as leave.
-- check_in_time is NOT NULL — use same placeholder as app (09:00 UTC on session date).

UPDATE attendance_sessions
SET
  status = 'holiday',
  check_in_time = ((date::text || 'T09:00:00.000Z')::timestamptz),
  check_out_time = ((date::text || 'T09:00:00.000Z')::timestamptz),
  duration_minutes = 0,
  description = 'Saturday / Sunday — company holiday.',
  updated_at = NOW()
WHERE status = 'leave'
  AND EXTRACT(DOW FROM date::date) IN (0, 6);
