item_output_limits.sql 1.5 KB

12345678910111213141516171819202122
  1. -- ******************************************************************
  2. -- 表 kku_item_output_limits 的创建SQL
  3. -- 对应的Model: App\Module\GameItems\Models\ItemOutputLimit
  4. -- 警告: 此文件由系统自动生成,禁止修改!
  5. -- ******************************************************************
  6. CREATE TABLE `kku_item_output_limits` (
  7. `id` int NOT NULL AUTO_INCREMENT COMMENT '记录ID,主键',
  8. `item_id` int NOT NULL COMMENT '物品ID,外键关联kku_item_items表',
  9. `limit_type` tinyint NOT NULL COMMENT '限制类型(1:全局总量, 2:单个用户, 3:单日全局, 4:单日用户)',
  10. `max_quantity` int NOT NULL COMMENT '最大产出数量',
  11. `current_quantity` int DEFAULT '0' COMMENT '当前已产出数量(全局限制时使用)',
  12. `reset_type` tinyint DEFAULT '0' COMMENT '重置类型(0:不重置, 1:每日, 2:每周, 3:每月)',
  13. `last_reset_time` timestamp NULL DEFAULT NULL COMMENT '上次重置时间',
  14. `related_items` json DEFAULT NULL COMMENT '关联物品ID列表,这些物品共享同一个限制额度',
  15. `created_at` timestamp NULL DEFAULT NULL COMMENT '创建时间',
  16. `updated_at` timestamp NULL DEFAULT NULL COMMENT '更新时间',
  17. PRIMARY KEY (`id`) USING BTREE,
  18. KEY `idx_item_id` (`item_id`) USING BTREE,
  19. KEY `idx_limit_reset` (`limit_type`,`reset_type`) USING BTREE,
  20. CONSTRAINT `fk_limit_item` FOREIGN KEY (`item_id`) REFERENCES `kku_item_items` (`id`) ON DELETE CASCADE ON UPDATE RESTRICT
  21. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='物品产出限制表';