-- ******************************************************************
-- 表 kku_farm_upgrade_logs 的创建SQL
-- 对应的Model: App\Module\Farm\Models\FarmUpgradeLog
-- 警告: 此文件由系统自动生成，禁止修改！
-- ******************************************************************

CREATE TABLE `kku_farm_upgrade_logs` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键ID',
  `user_id` bigint(20) NOT NULL COMMENT '用户ID',
  `upgrade_type` tinyint(3) unsigned NOT NULL COMMENT '升级类型:1土地,2房屋',
  `target_id` bigint(20) unsigned DEFAULT NULL COMMENT '目标ID(土地ID)',
  `old_level` tinyint(3) unsigned NOT NULL COMMENT '旧等级/类型',
  `new_level` tinyint(3) unsigned NOT NULL COMMENT '新等级/类型',
  `materials_consumed` json NOT NULL COMMENT '消耗的材料',
  `upgrade_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '升级时间',
  `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  PRIMARY KEY (`id`) USING BTREE,
  KEY `idx_user_id` (`user_id`) USING BTREE,
  KEY `idx_upgrade_time` (`upgrade_time`) USING BTREE,
  KEY `idx_upgrade_type` (`upgrade_type`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=DYNAMIC COMMENT='升级记录表';
