-- ****************************************************************** -- 表 kku_farm_crop_logs 的创建SQL -- 对应的Model: App\Module\Farm\Models\FarmCropLog -- 警告: 此文件由系统自动生成,禁止修改! -- ****************************************************************** CREATE TABLE `kku_farm_crop_logs` ( `id` bigint unsigned NOT NULL AUTO_INCREMENT COMMENT '主键ID', `user_id` bigint unsigned NOT NULL COMMENT '用户ID', `land_id` bigint unsigned NOT NULL COMMENT '土地ID', `crop_id` bigint unsigned NOT NULL COMMENT '作物ID', `seed_id` bigint 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(收获), fertilized(施肥), pesticide_used(使用杀虫剂), weedicide_used(使用除草剂), watering(浇水), removed(铲除作物), picked(摘取)', `event_data` json DEFAULT NULL COMMENT '事件详细数据', `growth_stage` tinyint unsigned NOT NULL COMMENT '发生时的生长阶段', `land_type` tinyint 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, KEY `idx_event_type_user` (`event_type`,`user_id`), KEY `idx_event_type_created` (`event_type`,`created_at`), 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 COMMENT='作物事件日志表';