ALTER TABLE team_messages
  ADD COLUMN replied_message_id CHAR(36) NULL AFTER body_text;

ALTER TABLE team_messages
  ADD KEY idx_team_messages_replied_message (replied_message_id);

ALTER TABLE team_messages
  ADD CONSTRAINT fk_team_messages_replied_message
    FOREIGN KEY (replied_message_id) REFERENCES team_messages (id)
    ON DELETE SET NULL;
