-- Co-Lite change add-lead-notifications: the staff notification bell. -- Target: `service-system`.`notification`, the unused table from Tastefully. Pre-check (read-only): -- SELECT COUNT(*) FROM `service-system`.`notification`; -- expect 0 -- The table is converted to utf8mb4 (names in any script) and gains babyboo's bell columns plus company_id -- and collapse_key. Existing columns keep their meaning. Run once. SET NAMES utf8mb4; USE `service-system`; ALTER TABLE `notification` CONVERT TO CHARACTER SET utf8mb4, ADD COLUMN `recipient_type` char(1) NULL COMMENT 'A = staff user' AFTER `receiver`, ADD COLUMN `company_id` bigint NULL AFTER `recipient_type`, ADD COLUMN `title` varchar(255) NULL COMMENT 'Message code' AFTER `company_id`, ADD COLUMN `type` varchar(45) NULL COMMENT 'LEAD_ASSIGNED, WEB_SIGNUP, WHATSAPP_MESSAGE, FOLLOW_UP_DUE' AFTER `message`, ADD COLUMN `link` varchar(512) NULL COMMENT 'Portal path opened on click' AFTER `type`, ADD COLUMN `collapse_key` varchar(100) NULL COMMENT 'An unread row with the same receiver and key is updated, not duplicated' AFTER `link`, ADD COLUMN `seen` tinyint(1) NOT NULL DEFAULT 0 AFTER `collapse_key`, ADD COLUMN `read_at` datetime NULL AFTER `seen`, ADD INDEX `idx_notification_inbox` (`recipient_type`, `receiver`, `seen`, `create_date_time`), ADD INDEX `idx_notification_collapse` (`receiver`, `collapse_key`, `seen`);