/*
 Navicat Premium Dump SQL

 Source Server         : 10.10.14.210
 Source Server Type    : MySQL
 Source Server Version : 50742 (5.7.42-log)
 Source Host           : 10.10.14.210:22066
 Source Schema         : base_db

 Target Server Type    : MySQL
 Target Server Version : 50742 (5.7.42-log)
 File Encoding         : 65001

 Date: 24/06/2025 18:45:23
*/

SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;

-- ----------------------------
-- Table structure for t_ai_kb
-- ----------------------------
DROP TABLE IF EXISTS `t_ai_kb`;
CREATE TABLE `t_ai_kb`  (
  `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键',
  `kb_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '知识库名称',
  `short_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '英文简称',
  `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  `is_delete` int(11) NOT NULL DEFAULT 0 COMMENT '是否删除',
  PRIMARY KEY (`id`) USING BTREE,
  UNIQUE INDEX `short_name`(`short_name`) USING BTREE,
  INDEX `is_delete`(`is_delete`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = 'AI知识库' ROW_FORMAT = Dynamic;

-- ----------------------------
-- Records of t_ai_kb
-- ----------------------------

-- ----------------------------
-- Table structure for t_ai_kb_files
-- ----------------------------
DROP TABLE IF EXISTS `t_ai_kb_files`;
CREATE TABLE `t_ai_kb_files`  (
  `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键',
  `file_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '文件名称',
  `ext_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '文件扩展名',
  `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  `kb_id` int(11) NOT NULL COMMENT '隶属知识库ID',
  `is_delete` int(11) NOT NULL DEFAULT 0 COMMENT '是否删除',
  `state` int(11) NOT NULL DEFAULT 0 COMMENT '0:上传后未处理，1：上传后已处理,2:处理失败',
  PRIMARY KEY (`id`) USING BTREE,
  INDEX `kb_id`(`kb_id`) USING BTREE,
  INDEX `is_delete`(`is_delete`, `state`) USING BTREE,
  CONSTRAINT `t_ai_kb_files_ibfk_1` FOREIGN KEY (`kb_id`) REFERENCES `t_ai_kb` (`id`) ON DELETE CASCADE ON UPDATE RESTRICT
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = 'AI知识库上传的文件' ROW_FORMAT = Dynamic;

-- ----------------------------
-- Records of t_ai_kb_files
-- ----------------------------

SET FOREIGN_KEY_CHECKS = 1;
