task_achievement_conditions.sql 1.8 KB

123456789101112131415161718192021222324
  1. -- ******************************************************************
  2. -- 表 kku_task_achievement_conditions 的创建SQL
  3. -- 对应的Model: App\Module\Task\Models\TaskAchievementCondition
  4. -- 警告: 此文件由系统自动生成,禁止修改!
  5. -- ******************************************************************
  6. CREATE TABLE `kku_task_achievement_conditions` (
  7. `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键',
  8. `task_id` int(11) NOT NULL COMMENT '任务ID,外键关联task_tasks表',
  9. `condition_id` int(11) NOT NULL COMMENT '条件ID,外键关联task_conditions表',
  10. `condition_type` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'progress' COMMENT '条件类型(prerequisite=前置条件,progress=进度条件)',
  11. `target_value` int(11) NOT NULL DEFAULT '1' COMMENT '目标值,如需要完成的次数',
  12. `params` json DEFAULT NULL COMMENT '条件参数,如特定物品ID、特定作物ID等',
  13. `operator` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '=' COMMENT '运算符,如=, >=, <=',
  14. `sort_order` int(11) NOT NULL DEFAULT '0' COMMENT '排序顺序,用于多条件任务',
  15. `is_required` tinyint(1) NOT NULL DEFAULT '1' COMMENT '是否必须满足此条件(0:否, 1:是)',
  16. `created_at` timestamp NULL DEFAULT NULL COMMENT '创建时间',
  17. `updated_at` timestamp NULL DEFAULT NULL COMMENT '更新时间',
  18. PRIMARY KEY (`id`) USING BTREE,
  19. KEY `idx_task_id` (`task_id`) USING BTREE,
  20. KEY `idx_condition_id` (`condition_id`) USING BTREE,
  21. KEY `idx_task_condition` (`task_id`,`condition_id`) USING BTREE,
  22. KEY `idx_condition_type` (`condition_type`) USING BTREE
  23. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=DYNAMIC COMMENT='任务达成条件表';