bmc_hub/migrations/141_email_threading_headers.sql
2026-03-02 23:58:56 +01:00

13 lines
545 B
SQL

-- Migration 141: Store email threading headers for helpdesk case routing
ALTER TABLE email_messages
ADD COLUMN IF NOT EXISTS in_reply_to VARCHAR(500),
ADD COLUMN IF NOT EXISTS email_references TEXT;
CREATE INDEX IF NOT EXISTS idx_email_messages_in_reply_to
ON email_messages(in_reply_to)
WHERE in_reply_to IS NOT NULL;
COMMENT ON COLUMN email_messages.in_reply_to IS 'Raw In-Reply-To header used for SAG-<id> threading lookup';
COMMENT ON COLUMN email_messages.email_references IS 'Raw References header used for SAG-<id> threading lookup';