-- 混剪任务表
CREATE TABLE IF NOT EXISTS `tik_mix_task` (
  `id` bigint NOT NULL AUTO_INCREMENT COMMENT 'ID',
  `tenant_id` bigint DEFAULT NULL COMMENT '租户编号',
  `user_id` bigint NOT NULL COMMENT '用户ID',
  `title` varchar(255) NOT NULL COMMENT '视频标题',
  `text` mediumtext NOT NULL COMMENT '文案内容',
  `video_urls` text COMMENT '视频素材URL列表(JSON)',
  `bg_music_urls` text COMMENT '背景音乐URL列表(JSON)',
  `produce_count` int NOT NULL DEFAULT '1' COMMENT '生成数量',
  `job_ids` text COMMENT '任务ID列表(JSON)',
  `output_urls` text COMMENT '输出文件URL列表(JSON)',
  `status` varchar(32) NOT NULL DEFAULT 'pending' COMMENT '任务状态(pending/running/success/failed)',
  `progress` int DEFAULT '0' COMMENT '进度(0-100)',
  `error_msg` text COMMENT '错误信息',
  `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
  `finish_time` datetime DEFAULT NULL COMMENT '完成时间',
  PRIMARY KEY (`id`),
  KEY `idx_user_id` (`user_id`),
  KEY `idx_status` (`status`),
  KEY `idx_create_time` (`create_time`),
  KEY `idx_user_status_time` (`user_id`, `status`, `create_time`),
  KEY `idx_status_time` (`status`, `create_time`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='混剪任务表';
