

----创建序列
CREATE SEQUENCE ai_knowledge_file_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

CREATE TABLE "public"."ai_knowledge_file" (
  "id" int4 NOT NULL DEFAULT nextval('ai_knowledge_file_seq'::regclass),
  "name" varchar(128) COLLATE "pg_catalog"."default",
  "url" varchar(256) COLLATE "pg_catalog"."default",
  "type" varchar(128) COLLATE "pg_catalog"."default",
  "size" "pg_catalog"."numeric",
  "parent_id" int4 DEFAULT 0,
  "vector_id" int4,
  "sort" int2,
  "creator" varchar(64) COLLATE "pg_catalog"."default",
  "create_time" timestamp(6),
  "updater" varchar(64) COLLATE "pg_catalog"."default",
  "update_time" timestamp(6),
  "deleted" "pg_catalog"."numeric" DEFAULT 0,
  "type_name" varchar(128) COLLATE "pg_catalog"."default"
)
;
COMMENT ON COLUMN "public"."ai_knowledge_file"."id" IS '主键ID';
COMMENT ON COLUMN "public"."ai_knowledge_file"."name" IS '文件名称';
COMMENT ON COLUMN "public"."ai_knowledge_file"."url" IS '文件URL';
COMMENT ON COLUMN "public"."ai_knowledge_file"."type" IS '文件类型';
COMMENT ON COLUMN "public"."ai_knowledge_file"."size" IS '文件大小';
COMMENT ON COLUMN "public"."ai_knowledge_file"."parent_id" IS '父ID';
COMMENT ON COLUMN "public"."ai_knowledge_file"."vector_id" IS '向量库ID';
COMMENT ON COLUMN "public"."ai_knowledge_file"."sort" IS '排序';
COMMENT ON COLUMN "public"."ai_knowledge_file"."type_name" IS '分类类型';

-- ----------------------------
-- Primary Key structure for table ai_knowledge_file
-- ----------------------------
ALTER TABLE "public"."ai_knowledge_file" ADD CONSTRAINT "ai_knowledage_file_pkey" PRIMARY KEY ("id");

----创建序列
CREATE SEQUENCE ai_knowledge_type_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;
	
CREATE TABLE "public"."ai_knowledge_type" (
  "id" int4 NOT NULL DEFAULT nextval('ai_knowledge_type_seq'::regclass),
  "name" varchar(128) COLLATE "pg_catalog"."default",
  "sort" int2,
  "parent_id" int4 NOT NULL DEFAULT 0,
  "creator" varchar(64) COLLATE "pg_catalog"."default",
  "create_time" timestamp(6),
  "updater" varchar(64) COLLATE "pg_catalog"."default",
  "update_time" timestamp(6),
  "deleted" "pg_catalog"."numeric" DEFAULT 0
)
;
COMMENT ON COLUMN "public"."ai_knowledge_type"."id" IS '主键ID';
COMMENT ON COLUMN "public"."ai_knowledge_type"."name" IS '分类名称';
COMMENT ON COLUMN "public"."ai_knowledge_type"."sort" IS '排序';
COMMENT ON COLUMN "public"."ai_knowledge_type"."parent_id" IS '父ID';

-- ----------------------------
-- Primary Key structure for table ai_knowledge_type
-- ----------------------------
ALTER TABLE "public"."ai_knowledge_type" ADD CONSTRAINT "ai_knowledge_type_pkey" PRIMARY KEY ("id");

