item_recipes.sql 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. -- ******************************************************************
  2. -- 表 kku_item_recipes 的创建SQL
  3. -- 对应的Model: App\Module\GameItems\Models\ItemRecipe
  4. -- 警告: 此文件由系统自动生成,禁止修改!
  5. -- ******************************************************************
  6. CREATE TABLE `kku_item_recipes` (
  7. `id` int NOT NULL AUTO_INCREMENT COMMENT '配方ID,主键',
  8. `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '配方名称',
  9. `code` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '配方编码(唯一)',
  10. `description` text COLLATE utf8mb4_unicode_ci COMMENT '配方描述',
  11. `consume_group_id` int unsigned DEFAULT NULL COMMENT '消耗组ID',
  12. `reward_group_id` int unsigned DEFAULT NULL COMMENT '奖励组ID',
  13. `condition_group_id` int unsigned DEFAULT NULL COMMENT '条件组ID',
  14. `result_item_id` int NOT NULL COMMENT '产出物品ID,外键关联kku_item_items表',
  15. `result_min_quantity` int DEFAULT '1' COMMENT '最小产出数量',
  16. `result_max_quantity` int DEFAULT '1' COMMENT '最大产出数量',
  17. `success_rate` decimal(5,2) NOT NULL COMMENT '成功率(百分比,最大100)',
  18. `coin_cost` json DEFAULT NULL COMMENT '货币成本,以JSON格式存储多种货币类型和数量',
  19. `level_required` int DEFAULT '1' COMMENT '所需等级',
  20. `is_default_unlocked` tinyint DEFAULT '0' COMMENT '是否默认解锁(0:否, 1:是)',
  21. `unlock_condition` json DEFAULT NULL COMMENT '解锁条件,以JSON格式存储',
  22. `cooldown_seconds` int DEFAULT '0' COMMENT '冷却时间(秒)',
  23. `category_id` int DEFAULT NULL COMMENT '配方分类ID',
  24. `sort_order` int DEFAULT '0' COMMENT '排序权重',
  25. `is_active` tinyint DEFAULT '1' COMMENT '是否激活(0:否, 1:是)',
  26. `created_at` timestamp NULL DEFAULT NULL COMMENT '创建时间',
  27. `updated_at` timestamp NULL DEFAULT NULL COMMENT '更新时间',
  28. PRIMARY KEY (`id`) USING BTREE,
  29. UNIQUE KEY `item_recipes_code_unique` (`code`),
  30. KEY `idx_result_item` (`result_item_id`) USING BTREE,
  31. KEY `idx_category` (`category_id`) USING BTREE,
  32. KEY `idx_consume_group_id` (`consume_group_id`),
  33. KEY `idx_reward_group_id` (`reward_group_id`),
  34. KEY `idx_condition_group_id` (`condition_group_id`),
  35. CONSTRAINT `fk_recipe_item` FOREIGN KEY (`result_item_id`) REFERENCES `kku_item_items` (`id`) ON DELETE CASCADE ON UPDATE RESTRICT
  36. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='物品合成配方(使用组系统)';