Files
AILab/server/SQL/ai_chat_history.sql
T
2025-09-18 17:10:02 +08:00

47 lines
1.6 KiB
SQL

/*
Navicat Premium Dump SQL
Source Server : 智能控制平台
Source Server Type : PostgreSQL
Source Server Version : 150013 (150013)
Source Host : 10.10.10.9:5432
Source Catalog : ktor2
Source Schema : public
Target Server Type : PostgreSQL
Target Server Version : 150013 (150013)
File Encoding : 65001
Date: 18/09/2025 16:09:38
*/
-- ----------------------------
-- Table structure for ai_chat_history
-- ----------------------------
DROP TABLE IF EXISTS "public"."ai_chat_history";
CREATE TABLE "public"."ai_chat_history" (
"id" uuid NOT NULL DEFAULT gen_random_uuid(),
"session_id" uuid NOT NULL,
"message" jsonb NOT NULL,
"created_at" timestamptz(6) NOT NULL DEFAULT now()
)
;
COMMENT ON COLUMN "public"."ai_chat_history"."id" IS '主键';
COMMENT ON COLUMN "public"."ai_chat_history"."session_id" IS '所属对话ID';
COMMENT ON COLUMN "public"."ai_chat_history"."message" IS '消息内容';
COMMENT ON COLUMN "public"."ai_chat_history"."created_at" IS '创建时间';
COMMENT ON TABLE "public"."ai_chat_history" IS 'AI对话历史记录';
-- ----------------------------
-- Indexes structure for table ai_chat_history
-- ----------------------------
CREATE INDEX "idx_ai_chat_history_session_id" ON "public"."ai_chat_history" USING btree (
"session_id" "pg_catalog"."uuid_ops" ASC NULLS LAST
);
-- ----------------------------
-- Primary Key structure for table ai_chat_history
-- ----------------------------
ALTER TABLE "public"."ai_chat_history" ADD CONSTRAINT "ai_chat_history_pkey" PRIMARY KEY ("id");