36716-vm/db/migrations/018_create_support_ticket_messages_table.sql
2025-12-07 05:00:42 +00:00

11 lines
496 B
SQL

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
);