-- Migration: add online class support to attendance_sessions
-- Run this once on existing databases after schema.sql is updated.

ALTER TABLE attendance_sessions
  ADD COLUMN online_class_id BIGINT UNSIGNED NULL AFTER schedule_id,
  ADD COLUMN type ENUM('in_person','online') NOT NULL DEFAULT 'in_person' AFTER online_class_id,
  ADD CONSTRAINT fk_att_sessions_online_class
    FOREIGN KEY (online_class_id) REFERENCES online_classes(id) ON DELETE SET NULL;
