pg.sql 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. DROP TABLE IF EXISTS log_error;
  2. CREATE TABLE log_error (
  3. id bigserial PRIMARY KEY, -- 主键
  4. "exception" text NULL, -- 异常
  5. message text NULL, -- 异常消息
  6. error_info text NULL, -- 异常详细消息
  7. error_stack_trace text NULL, -- 异常堆栈
  8. create_time timestamp(0) DEFAULT now() NULL -- 创建时间
  9. );
  10. COMMENT ON COLUMN log_error.id IS '主键';
  11. COMMENT ON COLUMN log_error."exception" IS '异常';
  12. COMMENT ON COLUMN log_error.message IS '异常消息';
  13. COMMENT ON COLUMN log_error.error_info IS '异常详细消息';
  14. COMMENT ON COLUMN log_error.error_stack_trace IS '异常堆栈';
  15. COMMENT ON COLUMN log_error.create_time IS '创建时间';
  16. DROP TABLE IF EXISTS chat_history;
  17. CREATE TABLE chat_history (
  18. id bigserial PRIMARY KEY, -- 主键
  19. user_id text NULL, -- 用户id
  20. "user_Q" text NULL, -- 用户提问
  21. "chat_A" text NULL, -- chat回答
  22. create_time timestamp(0) DEFAULT now() NULL, -- 创建时间
  23. update_time timestamp(0) DEFAULT now() NULL, -- 更改时间
  24. is_deleted int2 DEFAULT 0 NULL -- 是否删除
  25. );
  26. COMMENT ON COLUMN chat_history.id IS '主键';
  27. COMMENT ON COLUMN chat_history.user_id IS '用户id';
  28. COMMENT ON COLUMN chat_history."user_Q" IS '用户提问';
  29. COMMENT ON COLUMN chat_history."chat_A" IS 'chat回答';
  30. COMMENT ON COLUMN chat_history.create_time IS '创建时间';
  31. COMMENT ON COLUMN chat_history.update_time IS '更改时间';
  32. COMMENT ON COLUMN chat_history.is_deleted IS '是否删除';
  33. DROP TABLE IF EXISTS user_list;
  34. CREATE TABLE user_list (
  35. id bigserial primary key, -- 主键
  36. user_id text not null, -- 用户id
  37. user_name text, -- 用户名
  38. user_password text NULL, -- 密码
  39. create_time timestamp(0) DEFAULT now() NULL, -- 创建时间
  40. update_time timestamp(0) DEFAULT now() NULL, -- 更新时间
  41. is_deleted int2 default 0, -- 是否删除
  42. CONSTRAINT UNIQUE (user_name, is_deleted)
  43. );
  44. COMMENT ON TABLE user_list IS '用户列表';
  45. -- Column comments
  46. COMMENT ON COLUMN user_list.id IS '主键';
  47. COMMENT ON COLUMN user_list.user_id IS '用户id';
  48. COMMENT ON COLUMN user_list.user_name IS '用户名';
  49. COMMENT ON COLUMN user_list.user_password IS '密码';
  50. COMMENT ON COLUMN user_list.create_time IS '创建时间';
  51. COMMENT ON COLUMN user_list.update_time IS '更新时间';
  52. COMMENT ON COLUMN user_list.is_deleted IS '是否删除';