item_output_limits.sql 1.5 KB

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