-- Explicit dedup keys, ticket source and recurrence chains (#123) -- -- dedup_key: the key an automated reporter sends (scope:subject:kind). Not -- unique: every ticket in a recurrence chain carries it. tickets.hash stays -- UNIQUE and marks the one ticket that currently holds the dedup slot. -- Case-sensitive (ascii_bin), like the hash built from it. -- source: the API key name that created the ticket (gandalf, hwmonDaemon, thor), -- shown in place of "System". NULL for tickets made in the web UI or MCP. -- recurrence_of: for a ticket opened because a problem came back after the -- reopen window, the ticket_id of the previous occurrence. -- -- All three are nullable, so code from before this migration keeps working. ALTER TABLE `tickets` ADD COLUMN `dedup_key` varchar(128) CHARACTER SET ascii COLLATE ascii_bin DEFAULT NULL, ADD COLUMN `source` varchar(100) DEFAULT NULL, ADD COLUMN `recurrence_of` varchar(9) DEFAULT NULL, ADD KEY `idx_tickets_dedup_key` (`dedup_key`), ADD KEY `idx_tickets_source` (`source`), ADD KEY `idx_tickets_recurrence_of` (`recurrence_of`);