CREATE TABLE invite_links (
  id int(11) NOT NULL AUTO_INCREMENT,
  short_code varchar(32) NOT NULL,
  school_id int(11) NOT NULL,
  event_id int(11) NOT NULL,
  expires_at datetime NOT NULL,
  created_at datetime NOT NULL DEFAULT current_timestamp(),
  PRIMARY KEY (id),
  UNIQUE KEY uq_invite_links_short_code (short_code),
  KEY idx_invite_links_event (event_id),
  KEY idx_invite_links_school_event (school_id, event_id),
  CONSTRAINT fk_invite_links_event_id FOREIGN KEY (event_id) REFERENCES events (id) ON DELETE CASCADE,
  CONSTRAINT fk_invite_links_school_id FOREIGN KEY (school_id) REFERENCES schools (id) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;
