-- ****************************************************************** -- 表 kku_farm_crop_logs 的创建SQL -- 对应的Model: App\Module\Farm\Models\FarmCropLog -- 警告: 此文件由系统自动生成,禁止修改! -- ****************************************************************** CREATE TABLE `kku_farm_crop_logs` ( `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键ID', `user_id` bigint(20) unsigned NOT NULL COMMENT '用户ID', `land_id` bigint(20) unsigned NOT NULL COMMENT '土地ID', `crop_id` bigint(20) unsigned NOT NULL COMMENT '作物ID', `seed_id` bigint(20) unsigned NOT NULL COMMENT '种子ID', `event_type` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '事件类型:fruit_confirmed(确认果实种类), output_calculated(确认产出数量), disaster_occurred(灾害产生), disaster_cleared(灾害清除), harvested(收获)', `event_data` json DEFAULT NULL COMMENT '事件详细数据', `growth_stage` tinyint(3) unsigned NOT NULL COMMENT '发生时的生长阶段', `land_type` tinyint(3) unsigned NOT NULL COMMENT '土地类型', `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP COMMENT '事件发生时间', `updated_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, PRIMARY KEY (`id`) USING BTREE, KEY `idx_user_id` (`user_id`) USING BTREE, KEY `idx_crop_id` (`crop_id`) USING BTREE, KEY `idx_event_type` (`event_type`) USING BTREE, KEY `idx_created_at` (`created_at`) USING BTREE, KEY `idx_user_crop` (`user_id`,`crop_id`) USING BTREE, CONSTRAINT `farm_crop_logs_crop_id_foreign` FOREIGN KEY (`crop_id`) REFERENCES `kku_farm_crops` (`id`) ON DELETE CASCADE ON UPDATE RESTRICT ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=DYNAMIC COMMENT='作物事件日志表';