CREATE TABLE ticket_watchers (
  id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
  ticket_id INTEGER NOT NULL REFERENCES tickets(id) ON DELETE CASCADE,
  user_id UUID NOT NULL REFERENCES users(id) ON DELETE CASCADE,
  created_at TIMESTAMPTZ NOT NULL DEFAULT now(),
  UNIQUE(ticket_id, user_id)
);
CREATE INDEX ticket_watchers_ticket_id_idx ON ticket_watchers(ticket_id);
CREATE INDEX ticket_watchers_user_id_idx ON ticket_watchers(user_id);
