-- Apply before enabling IM_PUSH_CALLBACK_URL and IM_PUSH_CALLBACK_SECRET. CREATE TABLE IF NOT EXISTS `im_private_message_push_event` ( `id` bigint NOT NULL AUTO_INCREMENT, `message_id` bigint NOT NULL COMMENT 'IM private message id', `payload` text NOT NULL COMMENT 'Signed callback JSON snapshot', `status` tinyint NOT NULL DEFAULT 0 COMMENT '0 pending, 1 accepted, 2 expired', `attempt_count` int NOT NULL DEFAULT 0, `next_retry_time` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3), `last_error` varchar(200) DEFAULT NULL, `create_time` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3), `update_time` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3), PRIMARY KEY (`id`), UNIQUE KEY `uk_private_message_push_message` (`message_id`), KEY `idx_private_message_push_due` (`status`, `next_retry_time`, `id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='Durable private-message push delivery';