kku_item_recipes.sql 1.6 KB

12345678910111213141516171819202122232425
  1. -- 表 kku_item_recipes 的创建SQL
  2. DROP TABLE IF EXISTS `kku_item_recipes`;
  3. CREATE TABLE `kku_item_recipes` (
  4. `id` int NOT NULL AUTO_INCREMENT COMMENT '配方ID,主键',
  5. `name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '配方名称',
  6. `result_item_id` int NOT NULL COMMENT '产出物品ID,外键关联kku_item_items表',
  7. `result_min_quantity` int DEFAULT '1' COMMENT '最小产出数量',
  8. `result_max_quantity` int DEFAULT '1' COMMENT '最大产出数量',
  9. `success_rate` decimal(5,2) NOT NULL COMMENT '成功率(百分比,最大100)',
  10. `coin_cost` json DEFAULT NULL COMMENT '货币成本,以JSON格式存储多种货币类型和数量',
  11. `level_required` int DEFAULT '1' COMMENT '所需等级',
  12. `is_default_unlocked` tinyint DEFAULT '0' COMMENT '是否默认解锁(0:否, 1:是)',
  13. `unlock_condition` json DEFAULT NULL COMMENT '解锁条件,以JSON格式存储',
  14. `cooldown_seconds` int DEFAULT '0' COMMENT '冷却时间(秒)',
  15. `category_id` int DEFAULT NULL COMMENT '配方分类ID',
  16. `sort_order` int DEFAULT '0' COMMENT '排序权重',
  17. `is_active` tinyint DEFAULT '1' COMMENT '是否激活(0:否, 1:是)',
  18. `created_at` timestamp NULL DEFAULT NULL COMMENT '创建时间',
  19. `updated_at` timestamp NULL DEFAULT NULL COMMENT '更新时间',
  20. PRIMARY KEY (`id`),
  21. KEY `idx_result_item` (`result_item_id`),
  22. KEY `idx_category` (`category_id`),
  23. CONSTRAINT `fk_recipe_item` FOREIGN KEY (`result_item_id`) REFERENCES `kku_item_items` (`id`) ON DELETE CASCADE
  24. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='物品合成配方表';