ALTER TABLE training_registrations
  ADD COLUMN ticket_code VARCHAR(20) UNIQUE AFTER customer_id,
  ADD COLUMN attendance_status ENUM('registered','attended','cancelled') DEFAULT 'registered' AFTER ticket_code;

-- Generate ticket codes for existing registrations
UPDATE training_registrations
SET ticket_code = CONCAT('TKT-', UPPER(SUBSTRING(MD5(id), 1, 8)))
WHERE ticket_code IS NULL;
