-- 2026-02-05 修复 t_task_management 表缺失字段 (优化版：统一使用 task_id)
-- 如果你的数据库提示 "Unknown column 'ext_info'"，请运行以下脚本

ALTER TABLE `t_task_management` 
ADD COLUMN `project_id` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL AFTER `task_id`,
ADD COLUMN `annotation_status` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '标注状态' AFTER `type`,
ADD COLUMN `annotation_progress` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '进度' AFTER `annotation_status`,
ADD COLUMN `callback_url` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL COMMENT '回调地址' AFTER `annotation_progress`,
ADD COLUMN `ext_info` json NULL COMMENT '扩展信息' AFTER `callback_url`,
ADD COLUMN `create_time` datetime(0) NULL DEFAULT CURRENT_TIMESTAMP(0) COMMENT '创建时间' AFTER `ext_info`,
ADD COLUMN `update_time` datetime(0) NULL DEFAULT CURRENT_TIMESTAMP(0) ON UPDATE CURRENT_TIMESTAMP(0) COMMENT '更新时间' AFTER `create_time`,
ADD UNIQUE INDEX `idx_unique_biz_type_proj`(`business_id`, `type`, `project_id`) USING BTREE;
