ALTER TABLE `task_center_config`
  CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
ALTER TABLE `task_center_config`
  MODIFY COLUMN `id` bigint NOT NULL COMMENT '主键ID',
  MODIFY COLUMN `sys_origin` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '来源系统',
  MODIFY COLUMN `enabled` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否启用任务中心',
  MODIFY COLUMN `timezone` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'Asia/Riyadh' COMMENT '任务周期时区',
  MODIFY COLUMN `create_time` datetime(3) DEFAULT NULL COMMENT '创建时间',
  MODIFY COLUMN `update_time` datetime(3) DEFAULT NULL COMMENT '更新时间',
  COMMENT = '任务中心系统配置';

ALTER TABLE `task_center_task_config`
  CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
ALTER TABLE `task_center_task_config`
  MODIFY COLUMN `id` bigint NOT NULL COMMENT '主键ID',
  MODIFY COLUMN `config_id` bigint NOT NULL COMMENT '任务中心配置ID',
  MODIFY COLUMN `sys_origin` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '来源系统',
  MODIFY COLUMN `task_code` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '任务编码',
  MODIFY COLUMN `task_category` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '任务分类：DAILY/NEWBIE',
  MODIFY COLUMN `enabled` tinyint(1) NOT NULL DEFAULT '1' COMMENT '是否启用',
  MODIFY COLUMN `task_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '任务名称',
  MODIFY COLUMN `task_desc` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '任务说明',
  MODIFY COLUMN `condition_type` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '完成条件类型',
  MODIFY COLUMN `target_value` bigint NOT NULL DEFAULT '0' COMMENT '目标值',
  MODIFY COLUMN `target_unit` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '目标单位',
  MODIFY COLUMN `reward_gold` bigint NOT NULL DEFAULT '0' COMMENT '奖励金币',
  MODIFY COLUMN `jump_type` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'NONE' COMMENT '跳转类型',
  MODIFY COLUMN `jump_page` varchar(512) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '跳转参数',
  MODIFY COLUMN `task_icon` varchar(512) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '任务图标',
  MODIFY COLUMN `cover` varchar(512) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '任务封面',
  MODIFY COLUMN `sort_order` int NOT NULL DEFAULT '0' COMMENT '排序',
  MODIFY COLUMN `create_time` datetime(3) DEFAULT NULL COMMENT '创建时间',
  MODIFY COLUMN `update_time` datetime(3) DEFAULT NULL COMMENT '更新时间',
  COMMENT = '任务中心任务配置';

ALTER TABLE `task_center_condition_jump_config`
  CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
ALTER TABLE `task_center_condition_jump_config`
  MODIFY COLUMN `id` bigint NOT NULL COMMENT '主键ID',
  MODIFY COLUMN `config_id` bigint NOT NULL COMMENT '任务中心配置ID',
  MODIFY COLUMN `sys_origin` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '来源系统',
  MODIFY COLUMN `task_category` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '任务分类：DAILY/NEWBIE',
  MODIFY COLUMN `condition_type` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '完成条件类型',
  MODIFY COLUMN `jump_type` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'NONE' COMMENT '跳转类型',
  MODIFY COLUMN `jump_page` varchar(512) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '跳转参数',
  MODIFY COLUMN `sort_order` int NOT NULL DEFAULT '0' COMMENT '排序',
  MODIFY COLUMN `create_time` datetime(3) DEFAULT NULL COMMENT '创建时间',
  MODIFY COLUMN `update_time` datetime(3) DEFAULT NULL COMMENT '更新时间',
  COMMENT = '任务中心条件跳转配置';

ALTER TABLE `task_center_user_progress`
  CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
ALTER TABLE `task_center_user_progress`
  MODIFY COLUMN `id` bigint NOT NULL COMMENT '主键ID',
  MODIFY COLUMN `sys_origin` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '来源系统',
  MODIFY COLUMN `user_id` bigint NOT NULL COMMENT '用户ID',
  MODIFY COLUMN `task_id` bigint NOT NULL COMMENT '任务ID',
  MODIFY COLUMN `task_code` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '任务编码',
  MODIFY COLUMN `task_category` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '任务分类',
  MODIFY COLUMN `cycle_key` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '任务周期',
  MODIFY COLUMN `condition_type` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '完成条件类型',
  MODIFY COLUMN `completed_value` bigint NOT NULL DEFAULT '0' COMMENT '已完成值',
  MODIFY COLUMN `target_value` bigint NOT NULL DEFAULT '0' COMMENT '目标值',
  MODIFY COLUMN `status` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'IN_PROGRESS' COMMENT '任务状态',
  MODIFY COLUMN `reward_collected` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否已领取',
  MODIFY COLUMN `claimed_at` datetime(3) DEFAULT NULL COMMENT '领取时间',
  MODIFY COLUMN `create_time` datetime(3) DEFAULT NULL COMMENT '创建时间',
  MODIFY COLUMN `update_time` datetime(3) DEFAULT NULL COMMENT '更新时间',
  COMMENT = '任务中心用户进度';

ALTER TABLE `task_center_event`
  CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
ALTER TABLE `task_center_event`
  MODIFY COLUMN `id` bigint NOT NULL COMMENT '主键ID',
  MODIFY COLUMN `sys_origin` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '来源系统',
  MODIFY COLUMN `event_id` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '业务事件ID',
  MODIFY COLUMN `event_type` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '事件类型',
  MODIFY COLUMN `user_id` bigint NOT NULL COMMENT '用户ID',
  MODIFY COLUMN `task_id` bigint NOT NULL COMMENT '命中任务ID',
  MODIFY COLUMN `task_code` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '命中任务编码',
  MODIFY COLUMN `task_category` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '任务分类',
  MODIFY COLUMN `cycle_key` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '任务周期',
  MODIFY COLUMN `delta_value` bigint NOT NULL DEFAULT '0' COMMENT '本次增量',
  MODIFY COLUMN `completed_value` bigint NOT NULL DEFAULT '0' COMMENT '事件后完成值',
  MODIFY COLUMN `raw_json` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci COMMENT '原始事件内容',
  MODIFY COLUMN `occurred_at` datetime(3) DEFAULT NULL COMMENT '业务发生时间',
  MODIFY COLUMN `create_time` datetime(3) DEFAULT NULL COMMENT '创建时间',
  MODIFY COLUMN `update_time` datetime(3) DEFAULT NULL COMMENT '更新时间',
  COMMENT = '任务中心事件流水';

ALTER TABLE `task_center_claim_record`
  CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
ALTER TABLE `task_center_claim_record`
  MODIFY COLUMN `id` bigint NOT NULL COMMENT '主键ID',
  MODIFY COLUMN `sys_origin` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '来源系统',
  MODIFY COLUMN `user_id` bigint NOT NULL COMMENT '用户ID',
  MODIFY COLUMN `task_id` bigint NOT NULL COMMENT '任务ID',
  MODIFY COLUMN `task_code` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '任务编码',
  MODIFY COLUMN `task_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '任务名称快照',
  MODIFY COLUMN `task_category` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '任务分类',
  MODIFY COLUMN `cycle_key` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '任务周期',
  MODIFY COLUMN `reward_gold` bigint NOT NULL DEFAULT '0' COMMENT '奖励金币',
  MODIFY COLUMN `wallet_event_id` varchar(160) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '钱包事件ID',
  MODIFY COLUMN `status` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '领取状态',
  MODIFY COLUMN `failure_reason` varchar(512) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '失败原因',
  MODIFY COLUMN `claimed_at` datetime(3) DEFAULT NULL COMMENT '领取成功时间',
  MODIFY COLUMN `create_time` datetime(3) DEFAULT NULL COMMENT '创建时间',
  MODIFY COLUMN `update_time` datetime(3) DEFAULT NULL COMMENT '更新时间',
  COMMENT = '任务中心领取记录';
