-- SQL table definition
-- Generated from splitting a larger SQL file
-- Table: baidu_keyword
--

CREATE TABLE `baidu_keyword` (
  `id` int NOT NULL AUTO_INCREMENT,
  `keyword` varchar(255) NOT NULL,
  `crawled` tinyint DEFAULT '0',
  `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  `parents_id` int unsigned NOT NULL DEFAULT '0' COMMENT '父层级',
  `seed_id` int unsigned NOT NULL DEFAULT '0' COMMENT '种子',
  `seed_name` varchar(512) NOT NULL DEFAULT '' COMMENT '种子名称',
  `department` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL DEFAULT '' COMMENT '科室',
  `department_id` int unsigned NOT NULL DEFAULT '0' COMMENT '科室ID',
  `partsof_speech` varchar(128) NOT NULL DEFAULT '' COMMENT '词性',
  `partsof_speech_id` int unsigned NOT NULL DEFAULT '0' COMMENT '词性ID',
  `type` varchar(128) NOT NULL DEFAULT '' COMMENT '类型',
  `type_id` int unsigned NOT NULL DEFAULT '0' COMMENT '类型ID',
  `yesorno_question` enum('yes','no','unprocessed') CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL DEFAULT 'unprocessed' COMMENT '是否是问题?',
  `query_type_name` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '类型名称',
  `category_id` int NOT NULL DEFAULT '0' COMMENT '分类ID',
  `query_type_id` int NOT NULL DEFAULT '0' COMMENT '类型ID',
  `category_name` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '分类名称',
  `created_user_id` int NOT NULL DEFAULT '0' COMMENT '创建用户ID',
  `query_summary_status` enum('ready','doing','failed','finished') CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT 'ready',
  `query_status` enum('draft','ready','doing','failed','finished','similarity','automated_review','manual_review','generate','published') CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT 'draft' COMMENT 'query完整扭转流程状态',
  `blocking_reason` varchar(255) NOT NULL DEFAULT '' COMMENT '审核不通过原因',
  `article_id` int NOT NULL DEFAULT '0' COMMENT '文章ID',
  `query_stage` enum('draft','created','summary','reviewed','generated','published') NOT NULL DEFAULT 'draft' COMMENT '分5个阶段，创建|总结|审核|生文|发布',
  `status` enum('draft','available','unavailable','successful','failed') NOT NULL DEFAULT 'draft' COMMENT '状态_分2个阶段|可用|不可用|发布成功|发布失败',
  `updated_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `review_user_id` int NOT NULL DEFAULT '0' COMMENT '审核用户ID',
  PRIMARY KEY (`id`),
  UNIQUE KEY `keyword` (`keyword`),
  KEY `idx_crawled_seed` (`crawled`,`seed_id`),
  KEY `idx_created_at` (`created_at`)
) ENGINE=InnoDB AUTO_INCREMENT=798537 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
