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

CREATE TABLE `kku_thirdparty_monitors` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键ID',
  `service_id` bigint(20) unsigned NOT NULL COMMENT '服务ID',
  `check_type` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '检查类型（health/performance/availability）',
  `status` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '检查状态',
  `response_time` int(11) DEFAULT NULL COMMENT '响应时间（毫秒）',
  `status_code` int(11) DEFAULT NULL COMMENT 'HTTP状态码',
  `error_message` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci COMMENT '错误信息',
  `details` json DEFAULT NULL COMMENT '详细信息',
  `checked_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '检查时间',
  PRIMARY KEY (`id`) USING BTREE,
  KEY `idx_service_id` (`service_id`) USING BTREE,
  KEY `idx_check_type` (`check_type`) USING BTREE,
  KEY `idx_status` (`status`) USING BTREE,
  KEY `idx_checked_at` (`checked_at`) USING BTREE,
  CONSTRAINT `fk_monitors_service` FOREIGN KEY (`service_id`) REFERENCES `kku_thirdparty_services` (`id`) ON DELETE CASCADE ON UPDATE RESTRICT
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=DYNAMIC COMMENT='监控记录表';
