task_user_progress_modified.sql 1.0 KB

12345678910111213141516
  1. -- 修改后的用户任务进度表(关联到任务达成条件)
  2. DROP TABLE IF EXISTS `kku_task_user_progress`;
  3. CREATE TABLE `kku_task_user_progress` (
  4. `id` int NOT NULL AUTO_INCREMENT COMMENT '记录ID,主键',
  5. `user_id` int NOT NULL COMMENT '用户ID',
  6. `task_id` int NOT NULL COMMENT '任务ID,外键关联kku_task_tasks表',
  7. `achievement_condition_id` int NOT NULL COMMENT '达成条件ID,外键关联kku_task_achievement_conditions表',
  8. `current_value` int NOT NULL DEFAULT '0' COMMENT '当前值',
  9. `last_update_time` timestamp NULL DEFAULT NULL COMMENT '最后更新时间',
  10. `created_at` timestamp NULL DEFAULT NULL COMMENT '创建时间',
  11. `updated_at` timestamp NULL DEFAULT NULL COMMENT '更新时间',
  12. PRIMARY KEY (`id`),
  13. UNIQUE KEY `idx_user_task_condition` (`user_id`, `task_id`, `achievement_condition_id`),
  14. KEY `idx_user_task` (`user_id`, `task_id`),
  15. KEY `idx_achievement_condition` (`achievement_condition_id`)
  16. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='用户任务进度表';