<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="shop.alien.mapper.system.VideoModerationTaskMapper">
    
    <!-- 创建视频审核任务表 -->
    <update id="createTableIfNotExists">
        CREATE TABLE IF NOT EXISTS `video_moderation_task` (
          `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键ID',
          `data_id` varchar(64) NOT NULL COMMENT '数据ID',
          `video_url` varchar(512) NOT NULL COMMENT '视频URL',
          `task_id` varchar(64) NOT NULL COMMENT '任务ID',
          `status` varchar(20) NOT NULL DEFAULT 'SUBMITTED' COMMENT '任务状态 (SUBMITTED-已提交, PROCESSING-处理中, SUCCESS-成功, FAILED-失败)',
          `risk_level` varchar(10) DEFAULT NULL COMMENT '风险级别 (none-无风险, low-低风险, medium-中风险, high-高风险)',
          `result` text COMMENT '审核结果(JSON格式)',
          `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
          `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
          `retry_count` int(11) NOT NULL DEFAULT '0' COMMENT '重试次数',
          PRIMARY KEY (`id`),
          UNIQUE KEY `uk_task_id` (`task_id`),
          KEY `idx_status` (`status`),
          KEY `idx_create_time` (`create_time`)
        ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='视频审核任务表';
    </update>
    
</mapper>