CREATE TABLE IF NOT EXISTS `player_task_progress` (
  `id` bigint NOT NULL AUTO_INCREMENT COMMENT '主键ID',
  `user_id` bigint NOT NULL COMMENT '关联users.id',
  `task_id` varchar(80) NOT NULL COMMENT '静态任务ID',
  `cycle_key` varchar(32) NOT NULL COMMENT '任务周期键',
  `progress` int NOT NULL DEFAULT 0 COMMENT '当前进度',
  `activity_state` json NOT NULL COMMENT '去重活动目标等状态',
  `completed_at` timestamp NULL DEFAULT NULL COMMENT '完成时间',
  `claimed_at` timestamp NULL DEFAULT NULL COMMENT '领奖时间',
  `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  `updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
  PRIMARY KEY (`id`),
  UNIQUE KEY `uq_player_task_progress_task_cycle` (`user_id`, `task_id`, `cycle_key`),
  KEY `idx_player_task_progress_user_cycle` (`user_id`, `cycle_key`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='玩家任务进度表';
