ALTER TABLE team_message_threads
  ADD COLUMN case_id CHAR(36) NULL AFTER team_id;

ALTER TABLE team_message_threads
  ADD KEY idx_team_message_threads_case (case_id);

ALTER TABLE team_message_threads
  ADD CONSTRAINT fk_team_message_threads_case
  FOREIGN KEY (case_id) REFERENCES cases (id);
