pg.sql 3.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  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 unique, -- 用户名
  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 NULL -- 是否删除
  42. );
  43. COMMENT ON TABLE user_list IS '用户列表';
  44. -- Column comments
  45. COMMENT ON COLUMN user_list.id IS '主键';
  46. COMMENT ON COLUMN user_list.user_id IS '用户id';
  47. COMMENT ON COLUMN user_list.user_name IS '用户名';
  48. COMMENT ON COLUMN user_list.user_password IS '密码';
  49. COMMENT ON COLUMN user_list.create_time IS '创建时间';
  50. COMMENT ON COLUMN user_list.update_time IS '更新时间';
  51. COMMENT ON COLUMN user_list.is_deleted IS '是否删除';
  52. -- public.search_api definition
  53. -- Drop table
  54. DROP TABLE IF EXISTS search_api;
  55. CREATE TABLE search_api (
  56. id bigserial primary key, -- 自增主键
  57. s_method text DEFAULT 'GET'::text NULL, -- 请求方法
  58. s_url text NULL, -- 请求地址
  59. s_param text NULL, -- 请求参数
  60. s_description text NULL, -- 接口说明
  61. s_tsdescription tsvector NULL -- 接口说明的全文检索
  62. );
  63. CREATE INDEX ON public.search_api USING gin (s_tsdescription);
  64. -- Column comments
  65. COMMENT ON COLUMN public.search_api.id IS '自增主键';
  66. COMMENT ON COLUMN public.search_api.s_method IS '请求方法';
  67. COMMENT ON COLUMN public.search_api.s_url IS '请求地址';
  68. COMMENT ON COLUMN public.search_api.s_param IS '请求参数';
  69. COMMENT ON COLUMN public.search_api.s_description IS '接口说明';
  70. COMMENT ON COLUMN public.search_api.s_tsdescription IS '接口说明的全文检索';