-- Migration: Add ticket watchers table
-- Allows users to subscribe to ticket updates and receive Matrix notifications.

CREATE TABLE IF NOT EXISTS ticket_watchers (
    ticket_id  INT          NOT NULL,
    user_id    INT          NOT NULL,
    created_at TIMESTAMP    NOT NULL DEFAULT CURRENT_TIMESTAMP,
    PRIMARY KEY (ticket_id, user_id),
    INDEX idx_watcher_user (user_id)
);
