dingtalk.sql 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448
  1. -- ----------------------------
  2. -- Table structure for alert_config
  3. -- ----------------------------
  4. DROP TABLE IF EXISTS "dingtalk"."alert_config";
  5. CREATE TABLE "dingtalk"."alert_config" (
  6. "id" int4 NOT NULL,
  7. "robot_code" text COLLATE "pg_catalog"."default" NOT NULL,
  8. "robot_secret" text COLLATE "pg_catalog"."default",
  9. "open_conversation_id" text COLLATE "pg_catalog"."default",
  10. "phones" text COLLATE "pg_catalog"."default",
  11. "user_ids" text COLLATE "pg_catalog"."default"
  12. )
  13. ;
  14. COMMENT ON COLUMN "dingtalk"."alert_config"."robot_code" IS '机器人编码';
  15. COMMENT ON COLUMN "dingtalk"."alert_config"."robot_secret" IS '机器人密钥';
  16. COMMENT ON COLUMN "dingtalk"."alert_config"."open_conversation_id" IS '群id';
  17. COMMENT ON COLUMN "dingtalk"."alert_config"."phones" IS '手机号列表';
  18. COMMENT ON COLUMN "dingtalk"."alert_config"."user_ids" IS 'userId列表';
  19. COMMENT ON TABLE "dingtalk"."alert_config" IS '告警配置';
  20. -- ----------------------------
  21. -- Table structure for app
  22. -- ----------------------------
  23. DROP TABLE IF EXISTS "dingtalk"."app";
  24. CREATE TABLE "dingtalk"."app" (
  25. "app_id" text COLLATE "pg_catalog"."default" NOT NULL,
  26. "app_secret" text COLLATE "pg_catalog"."default",
  27. "app_name" text COLLATE "pg_catalog"."default",
  28. "create_time" timestamp(6) DEFAULT CURRENT_TIMESTAMP,
  29. "update_time" timestamp(6) DEFAULT CURRENT_TIMESTAMP,
  30. "deleted" int4 DEFAULT 0
  31. )
  32. ;
  33. COMMENT ON COLUMN "dingtalk"."app"."app_id" IS '应用编码';
  34. COMMENT ON COLUMN "dingtalk"."app"."app_secret" IS '应用密钥';
  35. COMMENT ON COLUMN "dingtalk"."app"."app_name" IS '应用名称';
  36. COMMENT ON COLUMN "dingtalk"."app"."create_time" IS '创建时间';
  37. COMMENT ON COLUMN "dingtalk"."app"."update_time" IS '更新时间';
  38. COMMENT ON COLUMN "dingtalk"."app"."deleted" IS '是否删除,0否1是';
  39. COMMENT ON TABLE "dingtalk"."app" IS '应用';
  40. -- ----------------------------
  41. -- Table structure for app_robot
  42. -- ----------------------------
  43. DROP TABLE IF EXISTS "dingtalk"."app_robot";
  44. CREATE TABLE "dingtalk"."app_robot" (
  45. "app_id" text COLLATE "pg_catalog"."default" NOT NULL,
  46. "robot_code" text COLLATE "pg_catalog"."default" NOT NULL
  47. )
  48. ;
  49. COMMENT ON COLUMN "dingtalk"."app_robot"."app_id" IS '应用编码';
  50. COMMENT ON COLUMN "dingtalk"."app_robot"."robot_code" IS '机器人编码';
  51. COMMENT ON TABLE "dingtalk"."app_robot" IS '应用机器人关联';
  52. -- ----------------------------
  53. -- Table structure for app_sftp
  54. -- ----------------------------
  55. DROP TABLE IF EXISTS "dingtalk"."app_sftp";
  56. CREATE TABLE "dingtalk"."app_sftp" (
  57. "sftp_id" text COLLATE "pg_catalog"."default" NOT NULL,
  58. "app_id" text COLLATE "pg_catalog"."default",
  59. "host" text COLLATE "pg_catalog"."default",
  60. "port" int4,
  61. "username" text COLLATE "pg_catalog"."default",
  62. "password" text COLLATE "pg_catalog"."default",
  63. "create_time" timestamp(6) DEFAULT CURRENT_TIMESTAMP,
  64. "update_time" timestamp(6) DEFAULT CURRENT_TIMESTAMP
  65. )
  66. ;
  67. COMMENT ON COLUMN "dingtalk"."app_sftp"."sftp_id" IS 'sftp id';
  68. COMMENT ON COLUMN "dingtalk"."app_sftp"."app_id" IS '应用编码';
  69. COMMENT ON COLUMN "dingtalk"."app_sftp"."host" IS '主机';
  70. COMMENT ON COLUMN "dingtalk"."app_sftp"."port" IS '端口';
  71. COMMENT ON COLUMN "dingtalk"."app_sftp"."username" IS '用户名';
  72. COMMENT ON COLUMN "dingtalk"."app_sftp"."password" IS '密码';
  73. COMMENT ON COLUMN "dingtalk"."app_sftp"."create_time" IS '创建时间';
  74. COMMENT ON COLUMN "dingtalk"."app_sftp"."update_time" IS '更新时间';
  75. COMMENT ON TABLE "dingtalk"."app_sftp" IS '应用sftp账号';
  76. -- ----------------------------
  77. -- Table structure for app_task
  78. -- ----------------------------
  79. DROP TABLE IF EXISTS "dingtalk"."app_task";
  80. CREATE TABLE "dingtalk"."app_task" (
  81. "task_id" text COLLATE "pg_catalog"."default" NOT NULL,
  82. "task_name" text COLLATE "pg_catalog"."default",
  83. "description" text COLLATE "pg_catalog"."default",
  84. "status" int4,
  85. "cron" text COLLATE "pg_catalog"."default",
  86. "app_id" text COLLATE "pg_catalog"."default",
  87. "robot_code" text COLLATE "pg_catalog"."default",
  88. "conversation_type" int4,
  89. "open_conversation_id" text COLLATE "pg_catalog"."default",
  90. "phones" text COLLATE "pg_catalog"."default",
  91. "user_ids" text COLLATE "pg_catalog"."default",
  92. "sftp_id" text COLLATE "pg_catalog"."default",
  93. "master_dir" text COLLATE "pg_catalog"."default",
  94. "has_subdirectory" int4,
  95. "subdirectory_method" text COLLATE "pg_catalog"."default",
  96. "dir_time_delay" int4,
  97. "subdirectory_pattern" text COLLATE "pg_catalog"."default",
  98. "file_to_text" int4,
  99. "file_method" text COLLATE "pg_catalog"."default",
  100. "file_time_delay" int4,
  101. "file_prefix" text COLLATE "pg_catalog"."default",
  102. "file_extension" text COLLATE "pg_catalog"."default",
  103. "file_pattern" text COLLATE "pg_catalog"."default",
  104. "task_timeout" int4,
  105. "max_retry_times" int4,
  106. "retry_interval" int4,
  107. "alert_type" text COLLATE "pg_catalog"."default",
  108. "alert_robot_code" text COLLATE "pg_catalog"."default",
  109. "alert_open_conversation_id" text COLLATE "pg_catalog"."default",
  110. "alert_phones" text COLLATE "pg_catalog"."default",
  111. "alert_user_ids" text COLLATE "pg_catalog"."default",
  112. "create_time" timestamp(6) DEFAULT CURRENT_TIMESTAMP,
  113. "update_time" timestamp(6) DEFAULT CURRENT_TIMESTAMP
  114. )
  115. ;
  116. COMMENT ON COLUMN "dingtalk"."app_task"."task_id" IS '任务id';
  117. COMMENT ON COLUMN "dingtalk"."app_task"."task_name" IS '任务名称';
  118. COMMENT ON COLUMN "dingtalk"."app_task"."description" IS '任务描述';
  119. COMMENT ON COLUMN "dingtalk"."app_task"."status" IS '任务状态,0已停止1运行中2已删除';
  120. COMMENT ON COLUMN "dingtalk"."app_task"."cron" IS 'cron表达式';
  121. COMMENT ON COLUMN "dingtalk"."app_task"."app_id" IS '应用编码';
  122. COMMENT ON COLUMN "dingtalk"."app_task"."robot_code" IS '机器人编码';
  123. COMMENT ON COLUMN "dingtalk"."app_task"."conversation_type" IS '会话类型:1:单聊,2:群聊';
  124. COMMENT ON COLUMN "dingtalk"."app_task"."open_conversation_id" IS '群id';
  125. COMMENT ON COLUMN "dingtalk"."app_task"."phones" IS '接收机器人消息的用户的手机号列表';
  126. COMMENT ON COLUMN "dingtalk"."app_task"."user_ids" IS '接收机器人消息的用户的userId列表';
  127. COMMENT ON COLUMN "dingtalk"."app_task"."sftp_id" IS 'sftp id';
  128. COMMENT ON COLUMN "dingtalk"."app_task"."master_dir" IS '数据主文件夹';
  129. COMMENT ON COLUMN "dingtalk"."app_task"."has_subdirectory" IS '是否有子文件夹,0否1是';
  130. COMMENT ON COLUMN "dingtalk"."app_task"."subdirectory_method" IS '子文件夹匹配方式';
  131. COMMENT ON COLUMN "dingtalk"."app_task"."dir_time_delay" IS '子文件夹时延';
  132. COMMENT ON COLUMN "dingtalk"."app_task"."subdirectory_pattern" IS '匹配最新子文件夹正则表达式';
  133. COMMENT ON COLUMN "dingtalk"."app_task"."file_to_text" IS '文件是否转为文本,0否1是';
  134. COMMENT ON COLUMN "dingtalk"."app_task"."file_method" IS '文件匹配方式';
  135. COMMENT ON COLUMN "dingtalk"."app_task"."file_time_delay" IS '文件时延';
  136. COMMENT ON COLUMN "dingtalk"."app_task"."file_prefix" IS '文件前缀';
  137. COMMENT ON COLUMN "dingtalk"."app_task"."file_extension" IS '文件扩展名';
  138. COMMENT ON COLUMN "dingtalk"."app_task"."file_pattern" IS '文件匹配正则表达式';
  139. COMMENT ON COLUMN "dingtalk"."app_task"."task_timeout" IS '任务超时时间秒';
  140. COMMENT ON COLUMN "dingtalk"."app_task"."max_retry_times" IS '失败重试次数';
  141. COMMENT ON COLUMN "dingtalk"."app_task"."retry_interval" IS '重试间隔秒';
  142. COMMENT ON COLUMN "dingtalk"."app_task"."alert_type" IS '告警方式';
  143. COMMENT ON COLUMN "dingtalk"."app_task"."alert_robot_code" IS '告警机器人编码';
  144. COMMENT ON COLUMN "dingtalk"."app_task"."alert_open_conversation_id" IS '告警群id';
  145. COMMENT ON COLUMN "dingtalk"."app_task"."alert_phones" IS '接收告警的手机号列表';
  146. COMMENT ON COLUMN "dingtalk"."app_task"."alert_user_ids" IS '接收告警的用户的userId列表';
  147. COMMENT ON COLUMN "dingtalk"."app_task"."create_time" IS '创建时间';
  148. COMMENT ON COLUMN "dingtalk"."app_task"."update_time" IS '更新时间';
  149. COMMENT ON TABLE "dingtalk"."app_task" IS '应用定时任务';
  150. -- ----------------------------
  151. -- Table structure for app_task_log
  152. -- ----------------------------
  153. DROP TABLE IF EXISTS "dingtalk"."app_task_log";
  154. CREATE TABLE "dingtalk"."app_task_log" (
  155. "id" text COLLATE "pg_catalog"."default" NOT NULL,
  156. "create_time" timestamp(6) DEFAULT CURRENT_TIMESTAMP,
  157. "task_id" text COLLATE "pg_catalog"."default",
  158. "task_name" text COLLATE "pg_catalog"."default",
  159. "app_id" text COLLATE "pg_catalog"."default",
  160. "app_name" text COLLATE "pg_catalog"."default",
  161. "status" int4,
  162. "detail" text COLLATE "pg_catalog"."default",
  163. "robot_code" text COLLATE "pg_catalog"."default",
  164. "robot_name" text COLLATE "pg_catalog"."default",
  165. "conversation_type" int4,
  166. "open_conversation_id" text COLLATE "pg_catalog"."default",
  167. "phones" text COLLATE "pg_catalog"."default",
  168. "user_ids" text COLLATE "pg_catalog"."default",
  169. "sftp_id" text COLLATE "pg_catalog"."default",
  170. "host" text COLLATE "pg_catalog"."default",
  171. "port" int4,
  172. "files" text COLLATE "pg_catalog"."default",
  173. "process_query_keys" text COLLATE "pg_catalog"."default"
  174. )
  175. ;
  176. COMMENT ON COLUMN "dingtalk"."app_task_log"."id" IS '日志id';
  177. COMMENT ON COLUMN "dingtalk"."app_task_log"."create_time" IS '执行时间';
  178. COMMENT ON COLUMN "dingtalk"."app_task_log"."task_id" IS '任务id';
  179. COMMENT ON COLUMN "dingtalk"."app_task_log"."task_name" IS '任务名称';
  180. COMMENT ON COLUMN "dingtalk"."app_task_log"."app_id" IS '应用编码';
  181. COMMENT ON COLUMN "dingtalk"."app_task_log"."app_name" IS '应用名称';
  182. COMMENT ON COLUMN "dingtalk"."app_task_log"."status" IS '任务执行状态,0失败1成功';
  183. COMMENT ON COLUMN "dingtalk"."app_task_log"."detail" IS '详情';
  184. COMMENT ON COLUMN "dingtalk"."app_task_log"."robot_code" IS '机器人编码';
  185. COMMENT ON COLUMN "dingtalk"."app_task_log"."robot_name" IS '机器人名称';
  186. COMMENT ON COLUMN "dingtalk"."app_task_log"."conversation_type" IS '会话类型:1:单聊,2:群聊';
  187. COMMENT ON COLUMN "dingtalk"."app_task_log"."open_conversation_id" IS '群id';
  188. COMMENT ON COLUMN "dingtalk"."app_task_log"."phones" IS '接收机器人消息的用户的手机号列表';
  189. COMMENT ON COLUMN "dingtalk"."app_task_log"."user_ids" IS '接收机器人消息的用户的userId列表';
  190. COMMENT ON COLUMN "dingtalk"."app_task_log"."sftp_id" IS 'sftp id';
  191. COMMENT ON COLUMN "dingtalk"."app_task_log"."host" IS 'sftp ip';
  192. COMMENT ON COLUMN "dingtalk"."app_task_log"."port" IS 'sftp端口';
  193. COMMENT ON COLUMN "dingtalk"."app_task_log"."files" IS '要发送的文件';
  194. COMMENT ON COLUMN "dingtalk"."app_task_log"."process_query_keys" IS '消息id列表';
  195. COMMENT ON TABLE "dingtalk"."app_task_log" IS '应用定时任务日志';
  196. -- ----------------------------
  197. -- Table structure for receive_message_log
  198. -- ----------------------------
  199. DROP TABLE IF EXISTS "dingtalk"."receive_message_log";
  200. CREATE TABLE "dingtalk"."receive_message_log" (
  201. "create_time" timestamp(6) DEFAULT CURRENT_TIMESTAMP,
  202. "robot_name" text COLLATE "pg_catalog"."default",
  203. "robot_code" text COLLATE "pg_catalog"."default",
  204. "sender_staff_id" text COLLATE "pg_catalog"."default",
  205. "sender_nick" text COLLATE "pg_catalog"."default",
  206. "content" text COLLATE "pg_catalog"."default",
  207. "msg_type" text COLLATE "pg_catalog"."default",
  208. "conversation_type" text COLLATE "pg_catalog"."default",
  209. "conversation_title" text COLLATE "pg_catalog"."default",
  210. "conversation_id" text COLLATE "pg_catalog"."default",
  211. "at_users" text COLLATE "pg_catalog"."default",
  212. "chatbot_corp_id" text COLLATE "pg_catalog"."default",
  213. "chatbot_user_id" text COLLATE "pg_catalog"."default",
  214. "msg_id" text COLLATE "pg_catalog"."default",
  215. "is_admin" text COLLATE "pg_catalog"."default",
  216. "session_webhook_expired_time" text COLLATE "pg_catalog"."default",
  217. "create_at" text COLLATE "pg_catalog"."default",
  218. "sender_corp_id" text COLLATE "pg_catalog"."default",
  219. "sender_id" text COLLATE "pg_catalog"."default",
  220. "is_in_at_list" text COLLATE "pg_catalog"."default",
  221. "session_webhook" text COLLATE "pg_catalog"."default"
  222. )
  223. ;
  224. COMMENT ON COLUMN "dingtalk"."receive_message_log"."create_time" IS '创建时间';
  225. COMMENT ON COLUMN "dingtalk"."receive_message_log"."robot_name" IS '机器人名称';
  226. COMMENT ON COLUMN "dingtalk"."receive_message_log"."robot_code" IS '机器人编码';
  227. COMMENT ON COLUMN "dingtalk"."receive_message_log"."sender_staff_id" IS '发送者 userId';
  228. COMMENT ON COLUMN "dingtalk"."receive_message_log"."sender_nick" IS '发送者昵称';
  229. COMMENT ON COLUMN "dingtalk"."receive_message_log"."content" IS '内容';
  230. COMMENT ON COLUMN "dingtalk"."receive_message_log"."msg_type" IS '消息类型';
  231. COMMENT ON COLUMN "dingtalk"."receive_message_log"."conversation_type" IS '会话类型:1:单聊2:群聊';
  232. COMMENT ON COLUMN "dingtalk"."receive_message_log"."conversation_title" IS '群聊时才有的会话标题';
  233. COMMENT ON COLUMN "dingtalk"."receive_message_log"."conversation_id" IS '会话 ID';
  234. COMMENT ON COLUMN "dingtalk"."receive_message_log"."at_users" IS '被@人的信息:dingtalkId:加密的发送者 ID。staffId:当前企业内部群中员工 userId 值。';
  235. COMMENT ON COLUMN "dingtalk"."receive_message_log"."chatbot_corp_id" IS '机器人所在的企业 corpId';
  236. COMMENT ON COLUMN "dingtalk"."receive_message_log"."chatbot_user_id" IS '加密的机器人 ID';
  237. COMMENT ON COLUMN "dingtalk"."receive_message_log"."msg_id" IS '加密的消息 ID';
  238. COMMENT ON COLUMN "dingtalk"."receive_message_log"."is_admin" IS '是否为管理员';
  239. COMMENT ON COLUMN "dingtalk"."receive_message_log"."session_webhook_expired_time" IS '当前会话的 Webhook 地址过期时间';
  240. COMMENT ON COLUMN "dingtalk"."receive_message_log"."create_at" IS '消息的时间戳,单位毫秒';
  241. COMMENT ON COLUMN "dingtalk"."receive_message_log"."sender_corp_id" IS '企业内部群有的发送者当前群的企业 corpId';
  242. COMMENT ON COLUMN "dingtalk"."receive_message_log"."sender_id" IS '加密的发送者 ID';
  243. COMMENT ON COLUMN "dingtalk"."receive_message_log"."is_in_at_list" IS '是否在@列表中';
  244. COMMENT ON COLUMN "dingtalk"."receive_message_log"."session_webhook" IS '当前会话的 Webhook 地址';
  245. COMMENT ON TABLE "dingtalk"."receive_message_log" IS '钉钉机器人接收消息日志';
  246. -- ----------------------------
  247. -- Table structure for request_log
  248. -- ----------------------------
  249. DROP TABLE IF EXISTS "dingtalk"."request_log";
  250. CREATE TABLE "dingtalk"."request_log" (
  251. "trace_id" text COLLATE "pg_catalog"."default",
  252. "request_time" timestamp(6),
  253. "ip" text COLLATE "pg_catalog"."default",
  254. "api" text COLLATE "pg_catalog"."default",
  255. "request_parameters" text COLLATE "pg_catalog"."default",
  256. "headers" text COLLATE "pg_catalog"."default",
  257. "open" int4,
  258. "username" text COLLATE "pg_catalog"."default",
  259. "app_name" text COLLATE "pg_catalog"."default",
  260. "app_id" text COLLATE "pg_catalog"."default",
  261. "time_stamp" timestamp(6),
  262. "token" text COLLATE "pg_catalog"."default"
  263. )
  264. ;
  265. COMMENT ON COLUMN "dingtalk"."request_log"."trace_id" IS '请求序列号';
  266. COMMENT ON COLUMN "dingtalk"."request_log"."request_time" IS '请求时间';
  267. COMMENT ON COLUMN "dingtalk"."request_log"."ip" IS 'ip';
  268. COMMENT ON COLUMN "dingtalk"."request_log"."api" IS '接口url';
  269. COMMENT ON COLUMN "dingtalk"."request_log"."request_parameters" IS '请求参数';
  270. COMMENT ON COLUMN "dingtalk"."request_log"."headers" IS '请求头';
  271. COMMENT ON COLUMN "dingtalk"."request_log"."open" IS '是否开放接口,0否1是';
  272. COMMENT ON COLUMN "dingtalk"."request_log"."username" IS '管理后台用户名';
  273. COMMENT ON COLUMN "dingtalk"."request_log"."app_name" IS '应用名称';
  274. COMMENT ON COLUMN "dingtalk"."request_log"."app_id" IS '应用id';
  275. COMMENT ON COLUMN "dingtalk"."request_log"."time_stamp" IS '时间戳';
  276. COMMENT ON COLUMN "dingtalk"."request_log"."token" IS '访问令牌';
  277. COMMENT ON TABLE "dingtalk"."request_log" IS '访问日志';
  278. -- ----------------------------
  279. -- Table structure for retry_app_task
  280. -- ----------------------------
  281. DROP TABLE IF EXISTS "dingtalk"."retry_app_task";
  282. CREATE TABLE "dingtalk"."retry_app_task" (
  283. "task_id" text COLLATE "pg_catalog"."default" NOT NULL,
  284. "retry_time" timestamp(6),
  285. "retry_times" int4
  286. )
  287. ;
  288. COMMENT ON COLUMN "dingtalk"."retry_app_task"."task_id" IS '任务id';
  289. COMMENT ON COLUMN "dingtalk"."retry_app_task"."retry_time" IS '重试时间';
  290. COMMENT ON COLUMN "dingtalk"."retry_app_task"."retry_times" IS '失败重试次数';
  291. COMMENT ON TABLE "dingtalk"."retry_app_task" IS '重试应用定时任务';
  292. -- ----------------------------
  293. -- Table structure for robot
  294. -- ----------------------------
  295. DROP TABLE IF EXISTS "dingtalk"."robot";
  296. CREATE TABLE "dingtalk"."robot" (
  297. "robot_code" text COLLATE "pg_catalog"."default" NOT NULL,
  298. "robot_secret" text COLLATE "pg_catalog"."default",
  299. "robot_name" text COLLATE "pg_catalog"."default",
  300. "create_time" timestamp(6) DEFAULT CURRENT_TIMESTAMP,
  301. "update_time" timestamp(6) DEFAULT CURRENT_TIMESTAMP,
  302. "deleted" int4 DEFAULT 0
  303. )
  304. ;
  305. COMMENT ON COLUMN "dingtalk"."robot"."robot_code" IS '机器人编码';
  306. COMMENT ON COLUMN "dingtalk"."robot"."robot_secret" IS '机器人密钥';
  307. COMMENT ON COLUMN "dingtalk"."robot"."robot_name" IS '机器人名称';
  308. COMMENT ON COLUMN "dingtalk"."robot"."create_time" IS '创建时间';
  309. COMMENT ON COLUMN "dingtalk"."robot"."update_time" IS '更新时间';
  310. COMMENT ON COLUMN "dingtalk"."robot"."deleted" IS '是否删除,0否1是';
  311. COMMENT ON TABLE "dingtalk"."robot" IS '钉钉机器人';
  312. -- ----------------------------
  313. -- Table structure for robot_command
  314. -- ----------------------------
  315. DROP TABLE IF EXISTS "dingtalk"."robot_command";
  316. CREATE TABLE "dingtalk"."robot_command" (
  317. "app_id" text COLLATE "pg_catalog"."default" NOT NULL,
  318. "robot_code" text COLLATE "pg_catalog"."default" NOT NULL,
  319. "command" text COLLATE "pg_catalog"."default" NOT NULL,
  320. "url" text COLLATE "pg_catalog"."default",
  321. "description" text COLLATE "pg_catalog"."default",
  322. "create_time" timestamp(6) DEFAULT CURRENT_TIMESTAMP,
  323. "update_time" timestamp(6) DEFAULT CURRENT_TIMESTAMP
  324. )
  325. ;
  326. COMMENT ON COLUMN "dingtalk"."robot_command"."app_id" IS '应用编码';
  327. COMMENT ON COLUMN "dingtalk"."robot_command"."robot_code" IS '机器人编码';
  328. COMMENT ON COLUMN "dingtalk"."robot_command"."command" IS '指令';
  329. COMMENT ON COLUMN "dingtalk"."robot_command"."url" IS '应用方接口';
  330. COMMENT ON COLUMN "dingtalk"."robot_command"."description" IS '说明';
  331. COMMENT ON COLUMN "dingtalk"."robot_command"."create_time" IS '创建时间';
  332. COMMENT ON COLUMN "dingtalk"."robot_command"."update_time" IS '更新时间';
  333. COMMENT ON TABLE "dingtalk"."robot_command" IS '机器人指令';
  334. -- ----------------------------
  335. -- Table structure for user
  336. -- ----------------------------
  337. DROP TABLE IF EXISTS "dingtalk"."user";
  338. CREATE TABLE "dingtalk"."user" (
  339. "username" text COLLATE "pg_catalog"."default" NOT NULL,
  340. "password" text COLLATE "pg_catalog"."default",
  341. "create_time" timestamp(6) DEFAULT CURRENT_TIMESTAMP,
  342. "update_time" timestamp(6) DEFAULT CURRENT_TIMESTAMP,
  343. "enable" int4 DEFAULT 1
  344. )
  345. ;
  346. COMMENT ON COLUMN "dingtalk"."user"."username" IS '用户名';
  347. COMMENT ON COLUMN "dingtalk"."user"."password" IS '密码';
  348. COMMENT ON COLUMN "dingtalk"."user"."create_time" IS '创建时间';
  349. COMMENT ON COLUMN "dingtalk"."user"."update_time" IS '更新时间';
  350. COMMENT ON COLUMN "dingtalk"."user"."enable" IS '是否启用,0否1是';
  351. COMMENT ON TABLE "dingtalk"."user" IS '用户';
  352. -- ----------------------------
  353. -- Primary Key structure for table alert_config
  354. -- ----------------------------
  355. ALTER TABLE "dingtalk"."alert_config" ADD CONSTRAINT "alert_config_pk" PRIMARY KEY ("id");
  356. -- ----------------------------
  357. -- Primary Key structure for table app
  358. -- ----------------------------
  359. ALTER TABLE "dingtalk"."app" ADD CONSTRAINT "app_pk" PRIMARY KEY ("app_id");
  360. -- ----------------------------
  361. -- Primary Key structure for table app_robot
  362. -- ----------------------------
  363. ALTER TABLE "dingtalk"."app_robot" ADD CONSTRAINT "app_robot_pk" PRIMARY KEY ("app_id", "robot_code");
  364. -- ----------------------------
  365. -- Indexes structure for table app_sftp
  366. -- ----------------------------
  367. CREATE INDEX "app_sftp_app_id_idx" ON "dingtalk"."app_sftp" USING btree (
  368. "app_id" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST
  369. );
  370. -- ----------------------------
  371. -- Primary Key structure for table app_sftp
  372. -- ----------------------------
  373. ALTER TABLE "dingtalk"."app_sftp" ADD CONSTRAINT "app_sftp_pk" PRIMARY KEY ("sftp_id");
  374. -- ----------------------------
  375. -- Indexes structure for table app_task
  376. -- ----------------------------
  377. CREATE INDEX "app_task_app_id_idx" ON "dingtalk"."app_task" USING btree (
  378. "app_id" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST
  379. );
  380. -- ----------------------------
  381. -- Primary Key structure for table app_task
  382. -- ----------------------------
  383. ALTER TABLE "dingtalk"."app_task" ADD CONSTRAINT "app_task_pk" PRIMARY KEY ("task_id");
  384. -- ----------------------------
  385. -- Indexes structure for table app_task_log
  386. -- ----------------------------
  387. CREATE INDEX "app_task_log_create_time_idx" ON "dingtalk"."app_task_log" USING btree (
  388. "create_time" "pg_catalog"."timestamp_ops" DESC NULLS FIRST,
  389. "task_id" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST
  390. );
  391. -- ----------------------------
  392. -- Indexes structure for table receive_message_log
  393. -- ----------------------------
  394. CREATE INDEX "receive_message_log_create_time_idx" ON "dingtalk"."receive_message_log" USING btree (
  395. "create_time" "pg_catalog"."timestamp_ops" DESC NULLS FIRST,
  396. "robot_code" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST,
  397. "sender_staff_id" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST,
  398. "sender_nick" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST
  399. );
  400. -- ----------------------------
  401. -- Indexes structure for table request_log
  402. -- ----------------------------
  403. CREATE INDEX "request_log_request_time_idx" ON "dingtalk"."request_log" USING btree (
  404. "request_time" "pg_catalog"."timestamp_ops" DESC NULLS FIRST,
  405. "app_id" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST,
  406. "app_name" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST
  407. );
  408. -- ----------------------------
  409. -- Primary Key structure for table retry_app_task
  410. -- ----------------------------
  411. ALTER TABLE "dingtalk"."retry_app_task" ADD CONSTRAINT "retry_app_task_pk" PRIMARY KEY ("task_id");
  412. -- ----------------------------
  413. -- Primary Key structure for table robot
  414. -- ----------------------------
  415. ALTER TABLE "dingtalk"."robot" ADD CONSTRAINT "robot_pk" PRIMARY KEY ("robot_code");
  416. -- ----------------------------
  417. -- Primary Key structure for table robot_command
  418. -- ----------------------------
  419. ALTER TABLE "dingtalk"."robot_command" ADD CONSTRAINT "robot_command_pk" PRIMARY KEY ("app_id", "robot_code", "command");
  420. -- ----------------------------
  421. -- Primary Key structure for table user
  422. -- ----------------------------
  423. ALTER TABLE "dingtalk"."user" ADD CONSTRAINT "user_pk" PRIMARY KEY ("username");