-- 域名管理模块表结构
SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;

DROP TABLE IF EXISTS `fa_domain`;
CREATE TABLE `fa_domain` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT 'ID',
  `admin_id` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '管理员ID',
  `domain` varchar(255) NOT NULL DEFAULT '' COMMENT '根域名',
  `full_url` varchar(512) NOT NULL DEFAULT '' COMMENT '完整链接',
  `zone_id` varchar(64) NOT NULL DEFAULT '' COMMENT 'Cloudflare Zone ID',
  `nameservers` text COMMENT 'CF分配的NS(JSON)',
  `zone_status` enum('pending','active','failed') NOT NULL DEFAULT 'pending' COMMENT 'Zone状态',
  `ns_status` enum('pending','verified','failed') NOT NULL DEFAULT 'pending' COMMENT 'NS状态',
  `dns_status` enum('pending','created','failed') NOT NULL DEFAULT 'pending' COMMENT 'DNS状态',
  `check_time` bigint(16) DEFAULT NULL COMMENT '检测时间',
  `check_result` varchar(2000) DEFAULT '' COMMENT '最近检测结果',
  `createtime` bigint(16) DEFAULT NULL COMMENT '创建时间',
  `updatetime` bigint(16) DEFAULT NULL COMMENT '更新时间',
  PRIMARY KEY (`id`),
  UNIQUE KEY `domain` (`domain`),
  KEY `admin_id` (`admin_id`),
  KEY `zone_status` (`zone_status`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='域名管理表';

SET FOREIGN_KEY_CHECKS = 1;
