
CREATE TABLE IF NOT EXISTS `support_ticket_messages` (
    `id` INT AUTO_INCREMENT PRIMARY KEY,
    `ticket_id` INT NOT NULL,
    `user_id` INT NOT NULL COMMENT 'Can be client_id or coach_id/admin_id',
    `is_admin` BOOLEAN NOT NULL DEFAULT FALSE COMMENT 'TRUE if the message is from an admin/coach, FALSE if from a client',
    `message` TEXT NOT NULL,
    `created_at` TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
    FOREIGN KEY (`ticket_id`) REFERENCES `support_tickets`(`id`) ON DELETE CASCADE
);
