-- Migration: 000155_training_notification_link -- Demand-collect broadcast deep links (2026-11 requirement: push the annual -- plan collection notice with a click-to-download template link and a -- "view more details" entry into the training system). -- 1) tr_notifications.link_url stores the frontend origin supplied by the -- broadcast caller (window.location.origin); the WeCom outbox consumer -- composes the markdown footer from it at dispatch time. Empty = no footer. -- 2) tr_notifications.link_token stores the HMAC-signed anonymous download -- token for the demand_collection template (signed-file endpoint; 20-day -- validity). Empty = no template line. DO $$ BEGIN RAISE NOTICE '[Migration 000155] Adding notification deep-link columns...'; END $$; ALTER TABLE tr_notifications ADD COLUMN IF NOT EXISTS link_url VARCHAR(512) NOT NULL DEFAULT '', ADD COLUMN IF NOT EXISTS link_token VARCHAR(255) NOT NULL DEFAULT ''; COMMENT ON COLUMN tr_notifications.link_url IS 'Frontend origin for WeCom markdown footer links (details page / signed template download); empty = no footer'; COMMENT ON COLUMN tr_notifications.link_token IS 'HMAC-signed anonymous download token for the demand_collection template; empty = none';