Files
senmesh-zc/db/聊天功能.sql
ran.shang 7e38b8d971 init
2025-06-11 09:42:13 +08:00

58 lines
2.2 KiB
SQL
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
CREATE TABLE "xs_chat"
(
"id" BIGINT IDENTITY(1, 1) NOT NULL PRIMARY KEY,
"org_id" BIGINT,
"org_user_id" BIGINT,
"person_user_id" BIGINT,
"type" VARCHAR(32),
"status" TINYINT,
"deleted" BIT DEFAULT 0 NOT NULL,
"create_by" BIGINT NOT NULL,
"create_time" TIMESTAMP(0) NOT NULL,
"update_by" BIGINT,
"update_time" TIMESTAMP(0),
"proxy_by" BIGINT
) ;
COMMENT ON TABLE "xs_chat" IS '聊天表';
COMMENT ON COLUMN "xs_chat"."org_id" IS '机构id';
COMMENT ON COLUMN "xs_chat"."org_user_id" IS '机构用户id';
COMMENT ON COLUMN "xs_chat"."person_user_id" IS '个人用户id';
COMMENT ON COLUMN "xs_chat"."type" IS '类型(chat_type)';
COMMENT ON COLUMN "xs_chat"."status" IS '状态:1有效,2关闭';
COMMENT ON COLUMN "xs_chat"."create_by" IS '创建人';
COMMENT ON COLUMN "xs_chat"."create_time" IS '创建时间';
COMMENT ON COLUMN "xs_chat"."deleted" IS '是否逻辑删除';
COMMENT ON COLUMN "xs_chat"."proxy_by" IS '代理人';
COMMENT ON COLUMN "xs_chat"."update_by" IS '更新人';
COMMENT ON COLUMN "xs_chat"."update_time" IS '更新时间';
CREATE TABLE "xs_chat_msg"
(
"id" BIGINT IDENTITY(1, 1) NOT NULL PRIMARY KEY,
"chat_id" BIGINT,
"sender_id" BIGINT,
"msg_type" VARCHAR(16),
"content" VARCHAR(1024),
"msg_status" TINYINT,
"deleted" BIT DEFAULT 0 NOT NULL,
"create_by" BIGINT NOT NULL,
"create_time" TIMESTAMP(0) NOT NULL,
"update_by" BIGINT,
"update_time" TIMESTAMP(0),
"proxy_by" BIGINT
) ;
COMMENT ON TABLE "xs_chat_msg" IS '聊天消息表';
COMMENT ON COLUMN "xs_chat_msg"."chat_id" IS '聊天id';
COMMENT ON COLUMN "xs_chat_msg"."sender_id" IS '发送用户id';
COMMENT ON COLUMN "xs_chat_msg"."msg_type" IS '消息类型(chat_msg_type):text等';
COMMENT ON COLUMN "xs_chat_msg"."content" IS '个人用户id';
COMMENT ON COLUMN "xs_chat_msg"."msg_status" IS '消息状态:1未读,2已读';
COMMENT ON COLUMN "xs_chat_msg"."create_by" IS '创建人';
COMMENT ON COLUMN "xs_chat_msg"."create_time" IS '创建时间';
COMMENT ON COLUMN "xs_chat_msg"."deleted" IS '是否逻辑删除';
COMMENT ON COLUMN "xs_chat_msg"."proxy_by" IS '代理人';
COMMENT ON COLUMN "xs_chat_msg"."update_by" IS '更新人';
COMMENT ON COLUMN "xs_chat_msg"."update_time" IS '更新时间';