item_user_recipes.sql 1.3 KB

12345678910111213141516171819202122
  1. -- ******************************************************************
  2. -- 表 kku_item_user_recipes 的创建SQL
  3. -- 对应的Model: App\Module\GameItems\Models\ItemUserRecipe
  4. -- 警告: 此文件由系统自动生成,禁止手动修改!
  5. -- ******************************************************************
  6. DROP TABLE IF EXISTS `kku_item_user_recipes`;
  7. CREATE TABLE `kku_item_user_recipes` (
  8. `id` int NOT NULL AUTO_INCREMENT COMMENT '记录ID,主键',
  9. `user_id` int NOT NULL COMMENT '用户ID',
  10. `recipe_id` int NOT NULL COMMENT '配方ID,外键关联kku_item_recipes表',
  11. `is_unlocked` tinyint DEFAULT '0' COMMENT '是否已解锁(0:否, 1:是)',
  12. `unlock_time` timestamp NULL DEFAULT NULL COMMENT '解锁时间',
  13. `last_craft_time` timestamp NULL DEFAULT NULL COMMENT '最后合成时间',
  14. `craft_count` int DEFAULT '0' COMMENT '合成次数',
  15. `created_at` timestamp NULL DEFAULT NULL COMMENT '创建时间',
  16. `updated_at` timestamp NULL DEFAULT NULL COMMENT '更新时间',
  17. PRIMARY KEY (`id`),
  18. UNIQUE KEY `idx_user_recipe` (`user_id`,`recipe_id`),
  19. KEY `fk_user_recipe` (`recipe_id`),
  20. CONSTRAINT `fk_user_recipe` FOREIGN KEY (`recipe_id`) REFERENCES `kku_item_recipes` (`id`) ON DELETE CASCADE
  21. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='用户配方解锁状态表';