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

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