schema.go 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547
  1. // Code generated by ent, DO NOT EDIT.
  2. package migrate
  3. import (
  4. "entgo.io/ent/dialect/entsql"
  5. "entgo.io/ent/dialect/sql/schema"
  6. "entgo.io/ent/schema/field"
  7. )
  8. var (
  9. // AgentColumns holds the columns for the "agent" table.
  10. AgentColumns = []*schema.Column{
  11. {Name: "id", Type: field.TypeUint64, Increment: true},
  12. {Name: "created_at", Type: field.TypeTime, Comment: "Create Time | 创建日期"},
  13. {Name: "updated_at", Type: field.TypeTime, Comment: "Update Time | 修改日期"},
  14. {Name: "deleted_at", Type: field.TypeTime, Nullable: true, Comment: "Delete Time | 删除日期"},
  15. {Name: "name", Type: field.TypeString, Size: 20, Comment: "name | 角色名称"},
  16. {Name: "role", Type: field.TypeString, Size: 1000, Comment: "role | 角色设定"},
  17. {Name: "status", Type: field.TypeInt, Nullable: true, Comment: "status | 状态 1-正常 2-禁用", Default: 1},
  18. {Name: "background", Type: field.TypeString, Size: 1000, Comment: "background | 背景介绍"},
  19. {Name: "examples", Type: field.TypeString, Size: 5000, Comment: "examples | 对话案例"},
  20. {Name: "organization_id", Type: field.TypeUint64, Comment: "organization_id | 租户ID"},
  21. }
  22. // AgentTable holds the schema information for the "agent" table.
  23. AgentTable = &schema.Table{
  24. Name: "agent",
  25. Columns: AgentColumns,
  26. PrimaryKey: []*schema.Column{AgentColumns[0]},
  27. }
  28. // BatchMsgColumns holds the columns for the "batch_msg" table.
  29. BatchMsgColumns = []*schema.Column{
  30. {Name: "id", Type: field.TypeUint64, Increment: true},
  31. {Name: "created_at", Type: field.TypeTime, Comment: "Create Time | 创建日期"},
  32. {Name: "updated_at", Type: field.TypeTime, Comment: "Update Time | 修改日期"},
  33. {Name: "deleted_at", Type: field.TypeTime, Nullable: true, Comment: "Delete Time | 删除日期"},
  34. {Name: "status", Type: field.TypeUint8, Nullable: true, Comment: "状态 0 未开始 1 开始发送 2 发送完成 3 发送中止"},
  35. {Name: "batch_no", Type: field.TypeString, Unique: true, Nullable: true, Comment: "批次号"},
  36. {Name: "fromwxid", Type: field.TypeString, Nullable: true, Comment: "发送方微信ID"},
  37. {Name: "msg", Type: field.TypeString, Nullable: true, Comment: "内容"},
  38. {Name: "tag", Type: field.TypeString, Nullable: true, Comment: "发送规则 all 全部 tag1,tag2 按tag发送"},
  39. {Name: "total", Type: field.TypeInt32, Nullable: true, Comment: "总数"},
  40. {Name: "success", Type: field.TypeInt32, Nullable: true, Comment: "成功数量"},
  41. {Name: "fail", Type: field.TypeInt32, Nullable: true, Comment: "失败数量"},
  42. {Name: "start_time", Type: field.TypeTime, Nullable: true, Comment: "开始时间"},
  43. {Name: "stop_time", Type: field.TypeTime, Nullable: true, Comment: "结束时间"},
  44. }
  45. // BatchMsgTable holds the schema information for the "batch_msg" table.
  46. BatchMsgTable = &schema.Table{
  47. Name: "batch_msg",
  48. Columns: BatchMsgColumns,
  49. PrimaryKey: []*schema.Column{BatchMsgColumns[0]},
  50. Indexes: []*schema.Index{
  51. {
  52. Name: "batchmsg_batch_no",
  53. Unique: true,
  54. Columns: []*schema.Column{BatchMsgColumns[5]},
  55. },
  56. },
  57. }
  58. // ContactColumns holds the columns for the "contact" table.
  59. ContactColumns = []*schema.Column{
  60. {Name: "id", Type: field.TypeUint64, Increment: true},
  61. {Name: "created_at", Type: field.TypeTime, Comment: "Create Time | 创建日期"},
  62. {Name: "updated_at", Type: field.TypeTime, Comment: "Update Time | 修改日期"},
  63. {Name: "status", Type: field.TypeUint8, Nullable: true, Comment: "Status 1: normal 2: ban | 状态 1 正常 2 禁用", Default: 1},
  64. {Name: "deleted_at", Type: field.TypeTime, Nullable: true, Comment: "Delete Time | 删除日期"},
  65. {Name: "wx_wxid", Type: field.TypeString, Nullable: true, Comment: "属主微信id", Default: ""},
  66. {Name: "type", Type: field.TypeInt, Nullable: true, Comment: "联系人类型:1好友,2群组,3公众号,4企业微信联系人", Default: 1},
  67. {Name: "wxid", Type: field.TypeString, Comment: "微信id 公众号微信ID", Default: ""},
  68. {Name: "account", Type: field.TypeString, Comment: "微信账号", Default: ""},
  69. {Name: "nickname", Type: field.TypeString, Comment: "微信昵称 群备注名称", Default: ""},
  70. {Name: "markname", Type: field.TypeString, Comment: "备注名", Default: ""},
  71. {Name: "headimg", Type: field.TypeString, Comment: "头像", Default: ""},
  72. {Name: "sex", Type: field.TypeInt, Comment: "性别 0未知 1男 2女", Default: 0},
  73. {Name: "starrole", Type: field.TypeString, Comment: "星标 65/67=星标 1/3=未星标", Default: ""},
  74. {Name: "dontseeit", Type: field.TypeInt, Comment: "不让他看我的朋友圈 0可以看 1不让看", Default: 0},
  75. {Name: "dontseeme", Type: field.TypeInt, Comment: "不看他的朋友圈 0可以看 1不看 1=开启了不看他 128/129=仅聊天", Default: 0},
  76. {Name: "lag", Type: field.TypeString, Comment: "所属标签id清单,多开会用逗号隔开", Default: ""},
  77. {Name: "gid", Type: field.TypeString, Comment: "群组id", Default: ""},
  78. {Name: "gname", Type: field.TypeString, Comment: "群组名称", Default: ""},
  79. {Name: "v3", Type: field.TypeString, Comment: "v3数据", Default: ""},
  80. {Name: "organization_id", Type: field.TypeUint64, Nullable: true, Comment: "机构 ID", Default: 1},
  81. }
  82. // ContactTable holds the schema information for the "contact" table.
  83. ContactTable = &schema.Table{
  84. Name: "contact",
  85. Columns: ContactColumns,
  86. PrimaryKey: []*schema.Column{ContactColumns[0]},
  87. Indexes: []*schema.Index{
  88. {
  89. Name: "contact_wx_wxid_wxid",
  90. Unique: true,
  91. Columns: []*schema.Column{ContactColumns[5], ContactColumns[7]},
  92. },
  93. {
  94. Name: "contact_wxid",
  95. Unique: false,
  96. Columns: []*schema.Column{ContactColumns[7]},
  97. },
  98. {
  99. Name: "contact_type",
  100. Unique: false,
  101. Columns: []*schema.Column{ContactColumns[6]},
  102. },
  103. {
  104. Name: "contact_gid",
  105. Unique: false,
  106. Columns: []*schema.Column{ContactColumns[17]},
  107. },
  108. },
  109. }
  110. // LabelColumns holds the columns for the "label" table.
  111. LabelColumns = []*schema.Column{
  112. {Name: "id", Type: field.TypeUint64, Increment: true},
  113. {Name: "created_at", Type: field.TypeTime, Comment: "Create Time | 创建日期"},
  114. {Name: "updated_at", Type: field.TypeTime, Comment: "Update Time | 修改日期"},
  115. {Name: "status", Type: field.TypeUint8, Nullable: true, Comment: "Status 1: normal 2: ban | 状态 1 正常 2 禁用", Default: 1},
  116. {Name: "type", Type: field.TypeInt, Comment: "标签类型:1好友,2群组,3公众号,4企业微信联系人", Default: 1},
  117. {Name: "name", Type: field.TypeString, Comment: "标签名称", Default: ""},
  118. {Name: "from", Type: field.TypeInt, Comment: "标签来源:1后台创建 2个微同步", Default: 1},
  119. {Name: "mode", Type: field.TypeInt, Comment: "标签模式:1动态 2静态", Default: 1},
  120. {Name: "conditions", Type: field.TypeString, Nullable: true, Comment: "标签的触达条件", Default: ""},
  121. {Name: "organization_id", Type: field.TypeUint64, Nullable: true, Comment: "机构 ID", Default: 1},
  122. }
  123. // LabelTable holds the schema information for the "label" table.
  124. LabelTable = &schema.Table{
  125. Name: "label",
  126. Columns: LabelColumns,
  127. PrimaryKey: []*schema.Column{LabelColumns[0]},
  128. Indexes: []*schema.Index{
  129. {
  130. Name: "label_name_from_mode",
  131. Unique: true,
  132. Columns: []*schema.Column{LabelColumns[5], LabelColumns[6], LabelColumns[7]},
  133. },
  134. },
  135. }
  136. // LabelRelationshipColumns holds the columns for the "label_relationship" table.
  137. LabelRelationshipColumns = []*schema.Column{
  138. {Name: "id", Type: field.TypeUint64, Increment: true},
  139. {Name: "created_at", Type: field.TypeTime, Comment: "Create Time | 创建日期"},
  140. {Name: "updated_at", Type: field.TypeTime, Comment: "Update Time | 修改日期"},
  141. {Name: "status", Type: field.TypeUint8, Nullable: true, Comment: "Status 1: normal 2: ban | 状态 1 正常 2 禁用", Default: 1},
  142. {Name: "deleted_at", Type: field.TypeTime, Nullable: true, Comment: "Delete Time | 删除日期"},
  143. {Name: "organization_id", Type: field.TypeUint64, Nullable: true, Comment: "机构 ID", Default: 1},
  144. {Name: "contact_id", Type: field.TypeUint64, Comment: "联系人 ID", Default: 1},
  145. {Name: "label_id", Type: field.TypeUint64, Comment: "标签 ID", Default: 1},
  146. }
  147. // LabelRelationshipTable holds the schema information for the "label_relationship" table.
  148. LabelRelationshipTable = &schema.Table{
  149. Name: "label_relationship",
  150. Columns: LabelRelationshipColumns,
  151. PrimaryKey: []*schema.Column{LabelRelationshipColumns[0]},
  152. ForeignKeys: []*schema.ForeignKey{
  153. {
  154. Symbol: "label_relationship_contact_contact_relationships",
  155. Columns: []*schema.Column{LabelRelationshipColumns[6]},
  156. RefColumns: []*schema.Column{ContactColumns[0]},
  157. OnDelete: schema.NoAction,
  158. },
  159. {
  160. Symbol: "label_relationship_label_label_relationships",
  161. Columns: []*schema.Column{LabelRelationshipColumns[7]},
  162. RefColumns: []*schema.Column{LabelColumns[0]},
  163. OnDelete: schema.NoAction,
  164. },
  165. },
  166. Indexes: []*schema.Index{
  167. {
  168. Name: "labelrelationship_label_id",
  169. Unique: false,
  170. Columns: []*schema.Column{LabelRelationshipColumns[7]},
  171. },
  172. {
  173. Name: "labelrelationship_contact_id",
  174. Unique: false,
  175. Columns: []*schema.Column{LabelRelationshipColumns[6]},
  176. },
  177. },
  178. }
  179. // MessagesColumns holds the columns for the "messages" table.
  180. MessagesColumns = []*schema.Column{
  181. {Name: "id", Type: field.TypeInt, Increment: true},
  182. {Name: "wx_wxid", Type: field.TypeString, Nullable: true, Comment: "属主微信id", Default: ""},
  183. {Name: "wxid", Type: field.TypeString, Comment: "微信id 公众号微信ID", Default: ""},
  184. {Name: "content", Type: field.TypeString, Comment: "微信消息内容", Default: ""},
  185. }
  186. // MessagesTable holds the schema information for the "messages" table.
  187. MessagesTable = &schema.Table{
  188. Name: "messages",
  189. Columns: MessagesColumns,
  190. PrimaryKey: []*schema.Column{MessagesColumns[0]},
  191. }
  192. // MessageRecordsColumns holds the columns for the "message_records" table.
  193. MessageRecordsColumns = []*schema.Column{
  194. {Name: "id", Type: field.TypeUint64, Increment: true},
  195. {Name: "created_at", Type: field.TypeTime, Comment: "Create Time | 创建日期"},
  196. {Name: "updated_at", Type: field.TypeTime, Comment: "Update Time | 修改日期"},
  197. {Name: "status", Type: field.TypeUint8, Nullable: true, Comment: "Status 1: normal 2: ban | 状态 1 正常 2 禁用", Default: 1},
  198. {Name: "deleted_at", Type: field.TypeTime, Nullable: true, Comment: "Delete Time | 删除日期"},
  199. {Name: "bot_wxid", Type: field.TypeString, Comment: "机器人微信 id"},
  200. {Name: "contact_type", Type: field.TypeInt, Comment: "类型:1好友,2群组,3企业微信联系人", Default: 1},
  201. {Name: "contact_wxid", Type: field.TypeString, Comment: "接收方微信 id", Default: ""},
  202. {Name: "content_type", Type: field.TypeInt, Comment: "内容类型 1 文本 2 文件", Default: 1},
  203. {Name: "content", Type: field.TypeString, Comment: "发送内容", Default: ""},
  204. {Name: "meta", Type: field.TypeJSON, Nullable: true, Comment: "元数据"},
  205. {Name: "error_detail", Type: field.TypeString, Comment: "异常原因", Default: ""},
  206. {Name: "send_time", Type: field.TypeTime, Nullable: true, Comment: "发送时间"},
  207. {Name: "source_type", Type: field.TypeInt, Comment: "源类型 1 点发 2 群发 3 SOP", Default: 1},
  208. {Name: "organization_id", Type: field.TypeUint64, Nullable: true, Comment: "机构 ID", Default: 1},
  209. {Name: "contact_id", Type: field.TypeUint64, Nullable: true, Comment: "联系人 id"},
  210. {Name: "sub_source_id", Type: field.TypeUint64, Nullable: true, Comment: "次源 ID", Default: 1},
  211. {Name: "source_id", Type: field.TypeUint64, Nullable: true, Comment: "源 ID", Default: 1},
  212. }
  213. // MessageRecordsTable holds the schema information for the "message_records" table.
  214. MessageRecordsTable = &schema.Table{
  215. Name: "message_records",
  216. Columns: MessageRecordsColumns,
  217. PrimaryKey: []*schema.Column{MessageRecordsColumns[0]},
  218. ForeignKeys: []*schema.ForeignKey{
  219. {
  220. Symbol: "message_records_contact_contact_messages",
  221. Columns: []*schema.Column{MessageRecordsColumns[15]},
  222. RefColumns: []*schema.Column{ContactColumns[0]},
  223. OnDelete: schema.SetNull,
  224. },
  225. {
  226. Symbol: "message_records_sop_node_node_messages",
  227. Columns: []*schema.Column{MessageRecordsColumns[16]},
  228. RefColumns: []*schema.Column{SopNodeColumns[0]},
  229. OnDelete: schema.SetNull,
  230. },
  231. {
  232. Symbol: "message_records_sop_stage_stage_messages",
  233. Columns: []*schema.Column{MessageRecordsColumns[17]},
  234. RefColumns: []*schema.Column{SopStageColumns[0]},
  235. OnDelete: schema.SetNull,
  236. },
  237. },
  238. Indexes: []*schema.Index{
  239. {
  240. Name: "messagerecords_source_type",
  241. Unique: false,
  242. Columns: []*schema.Column{MessageRecordsColumns[13]},
  243. },
  244. },
  245. }
  246. // MsgColumns holds the columns for the "msg" table.
  247. MsgColumns = []*schema.Column{
  248. {Name: "id", Type: field.TypeUint64, Increment: true},
  249. {Name: "created_at", Type: field.TypeTime, Comment: "Create Time | 创建日期"},
  250. {Name: "updated_at", Type: field.TypeTime, Comment: "Update Time | 修改日期"},
  251. {Name: "deleted_at", Type: field.TypeTime, Nullable: true, Comment: "Delete Time | 删除日期"},
  252. {Name: "status", Type: field.TypeUint8, Nullable: true, Comment: "Status 1: normal 2: ban | 状态 1 正常 2 禁用"},
  253. {Name: "fromwxid", Type: field.TypeString, Nullable: true, Comment: "发送方微信ID"},
  254. {Name: "toid", Type: field.TypeString, Nullable: true, Comment: "接收人微信ID/群ID"},
  255. {Name: "msgtype", Type: field.TypeInt32, Nullable: true, Comment: "消息类型"},
  256. {Name: "msg", Type: field.TypeString, Nullable: true, Comment: "消息"},
  257. {Name: "batch_no", Type: field.TypeString, Nullable: true, Comment: "批次号"},
  258. }
  259. // MsgTable holds the schema information for the "msg" table.
  260. MsgTable = &schema.Table{
  261. Name: "msg",
  262. Columns: MsgColumns,
  263. PrimaryKey: []*schema.Column{MsgColumns[0]},
  264. Indexes: []*schema.Index{
  265. {
  266. Name: "msg_batch_no",
  267. Unique: false,
  268. Columns: []*schema.Column{MsgColumns[9]},
  269. },
  270. {
  271. Name: "msg_id",
  272. Unique: false,
  273. Columns: []*schema.Column{MsgColumns[0]},
  274. },
  275. {
  276. Name: "msg_status",
  277. Unique: false,
  278. Columns: []*schema.Column{MsgColumns[4]},
  279. },
  280. },
  281. }
  282. // ServerColumns holds the columns for the "server" table.
  283. ServerColumns = []*schema.Column{
  284. {Name: "id", Type: field.TypeUint64, Increment: true},
  285. {Name: "created_at", Type: field.TypeTime, Comment: "Create Time | 创建日期"},
  286. {Name: "updated_at", Type: field.TypeTime, Comment: "Update Time | 修改日期"},
  287. {Name: "status", Type: field.TypeUint8, Nullable: true, Comment: "Status 1: normal 2: ban | 状态 1 正常 2 禁用", Default: 1},
  288. {Name: "deleted_at", Type: field.TypeTime, Nullable: true, Comment: "Delete Time | 删除日期"},
  289. {Name: "name", Type: field.TypeString, Comment: "名称"},
  290. {Name: "public_ip", Type: field.TypeString, Comment: "公网ip"},
  291. {Name: "private_ip", Type: field.TypeString, Comment: "内网ip"},
  292. {Name: "admin_port", Type: field.TypeString, Comment: "管理端口"},
  293. }
  294. // ServerTable holds the schema information for the "server" table.
  295. ServerTable = &schema.Table{
  296. Name: "server",
  297. Columns: ServerColumns,
  298. PrimaryKey: []*schema.Column{ServerColumns[0]},
  299. Indexes: []*schema.Index{
  300. {
  301. Name: "server_name",
  302. Unique: false,
  303. Columns: []*schema.Column{ServerColumns[5]},
  304. },
  305. {
  306. Name: "server_private_ip",
  307. Unique: false,
  308. Columns: []*schema.Column{ServerColumns[7]},
  309. },
  310. {
  311. Name: "server_public_ip",
  312. Unique: true,
  313. Columns: []*schema.Column{ServerColumns[6]},
  314. },
  315. },
  316. }
  317. // SopNodeColumns holds the columns for the "sop_node" table.
  318. SopNodeColumns = []*schema.Column{
  319. {Name: "id", Type: field.TypeUint64, Increment: true},
  320. {Name: "created_at", Type: field.TypeTime, Comment: "Create Time | 创建日期"},
  321. {Name: "updated_at", Type: field.TypeTime, Comment: "Update Time | 修改日期"},
  322. {Name: "status", Type: field.TypeUint8, Nullable: true, Comment: "Status 1: normal 2: ban | 状态 1 正常 2 禁用", Default: 1},
  323. {Name: "deleted_at", Type: field.TypeTime, Nullable: true, Comment: "Delete Time | 删除日期"},
  324. {Name: "parent_id", Type: field.TypeUint64, Comment: "父节点 ID"},
  325. {Name: "name", Type: field.TypeString, Comment: "节点名称", Default: ""},
  326. {Name: "condition_type", Type: field.TypeInt, Comment: "触发条件类型 1 客户回复后触发 2 超时后触发", Default: 1},
  327. {Name: "condition_list", Type: field.TypeJSON, Nullable: true, Comment: "触发语义列表 当为空时则代表用户回复任意内容后触发"},
  328. {Name: "no_reply_condition", Type: field.TypeUint64, Comment: "超时触发时间(分钟)", Default: 0},
  329. {Name: "action_message", Type: field.TypeJSON, Nullable: true, Comment: "命中后发送的消息内容"},
  330. {Name: "action_label", Type: field.TypeJSON, Nullable: true, Comment: "命中后需要打的标签"},
  331. {Name: "stage_id", Type: field.TypeUint64, Comment: "阶段 ID"},
  332. }
  333. // SopNodeTable holds the schema information for the "sop_node" table.
  334. SopNodeTable = &schema.Table{
  335. Name: "sop_node",
  336. Columns: SopNodeColumns,
  337. PrimaryKey: []*schema.Column{SopNodeColumns[0]},
  338. ForeignKeys: []*schema.ForeignKey{
  339. {
  340. Symbol: "sop_node_sop_stage_stage_nodes",
  341. Columns: []*schema.Column{SopNodeColumns[12]},
  342. RefColumns: []*schema.Column{SopStageColumns[0]},
  343. OnDelete: schema.NoAction,
  344. },
  345. },
  346. Indexes: []*schema.Index{
  347. {
  348. Name: "sopnode_name",
  349. Unique: false,
  350. Columns: []*schema.Column{SopNodeColumns[6]},
  351. },
  352. },
  353. }
  354. // SopStageColumns holds the columns for the "sop_stage" table.
  355. SopStageColumns = []*schema.Column{
  356. {Name: "id", Type: field.TypeUint64, Increment: true},
  357. {Name: "created_at", Type: field.TypeTime, Comment: "Create Time | 创建日期"},
  358. {Name: "updated_at", Type: field.TypeTime, Comment: "Update Time | 修改日期"},
  359. {Name: "status", Type: field.TypeUint8, Nullable: true, Comment: "Status 1: normal 2: ban | 状态 1 正常 2 禁用", Default: 1},
  360. {Name: "deleted_at", Type: field.TypeTime, Nullable: true, Comment: "Delete Time | 删除日期"},
  361. {Name: "name", Type: field.TypeString, Comment: "阶段名称", Default: ""},
  362. {Name: "condition_type", Type: field.TypeInt, Comment: "客群筛选条件类型 1 按标签筛选 2 按客户基本信息筛选", Default: 1},
  363. {Name: "condition_operator", Type: field.TypeInt, Comment: "筛选条件关系 1 满足所有条件(and) 2 满足任意条件(or)", Default: 1},
  364. {Name: "condition_list", Type: field.TypeJSON, Comment: "筛选条件列表"},
  365. {Name: "action_message", Type: field.TypeJSON, Nullable: true, Comment: "命中后发送的消息内容"},
  366. {Name: "action_label", Type: field.TypeJSON, Nullable: true, Comment: "命中后需要打的标签"},
  367. {Name: "index_sort", Type: field.TypeInt, Nullable: true, Comment: "阶段顺序", Default: 1},
  368. {Name: "task_id", Type: field.TypeUint64, Comment: "SOP 任务 ID"},
  369. }
  370. // SopStageTable holds the schema information for the "sop_stage" table.
  371. SopStageTable = &schema.Table{
  372. Name: "sop_stage",
  373. Columns: SopStageColumns,
  374. PrimaryKey: []*schema.Column{SopStageColumns[0]},
  375. ForeignKeys: []*schema.ForeignKey{
  376. {
  377. Symbol: "sop_stage_sop_task_task_stages",
  378. Columns: []*schema.Column{SopStageColumns[12]},
  379. RefColumns: []*schema.Column{SopTaskColumns[0]},
  380. OnDelete: schema.NoAction,
  381. },
  382. },
  383. Indexes: []*schema.Index{
  384. {
  385. Name: "sopstage_name",
  386. Unique: false,
  387. Columns: []*schema.Column{SopStageColumns[5]},
  388. },
  389. },
  390. }
  391. // SopTaskColumns holds the columns for the "sop_task" table.
  392. SopTaskColumns = []*schema.Column{
  393. {Name: "id", Type: field.TypeUint64, Increment: true},
  394. {Name: "created_at", Type: field.TypeTime, Comment: "Create Time | 创建日期"},
  395. {Name: "updated_at", Type: field.TypeTime, Comment: "Update Time | 修改日期"},
  396. {Name: "status", Type: field.TypeUint8, Nullable: true, Comment: "Status 1: normal 2: ban | 状态 1 正常 2 禁用", Default: 1},
  397. {Name: "deleted_at", Type: field.TypeTime, Nullable: true, Comment: "Delete Time | 删除日期"},
  398. {Name: "name", Type: field.TypeString, Comment: "SOP 任务名称"},
  399. {Name: "bot_wxid_list", Type: field.TypeJSON, Nullable: true, Comment: "机器人微信 id 列表"},
  400. {Name: "type", Type: field.TypeInt, Comment: "标签类型:1好友,2群组,3企业微信联系人", Default: 1},
  401. {Name: "plan_start_time", Type: field.TypeTime, Nullable: true, Comment: "任务计划开始时间"},
  402. {Name: "plan_end_time", Type: field.TypeTime, Nullable: true, Comment: "任务计划结束时间"},
  403. {Name: "creator_id", Type: field.TypeString, Nullable: true, Comment: "创建者 id"},
  404. {Name: "organization_id", Type: field.TypeUint64, Nullable: true, Comment: "机构 ID", Default: 1},
  405. }
  406. // SopTaskTable holds the schema information for the "sop_task" table.
  407. SopTaskTable = &schema.Table{
  408. Name: "sop_task",
  409. Columns: SopTaskColumns,
  410. PrimaryKey: []*schema.Column{SopTaskColumns[0]},
  411. Indexes: []*schema.Index{
  412. {
  413. Name: "soptask_name",
  414. Unique: false,
  415. Columns: []*schema.Column{SopTaskColumns[5]},
  416. },
  417. },
  418. }
  419. // WxColumns holds the columns for the "wx" table.
  420. WxColumns = []*schema.Column{
  421. {Name: "id", Type: field.TypeUint64, Increment: true},
  422. {Name: "created_at", Type: field.TypeTime, Comment: "Create Time | 创建日期"},
  423. {Name: "updated_at", Type: field.TypeTime, Comment: "Update Time | 修改日期"},
  424. {Name: "status", Type: field.TypeUint8, Nullable: true, Comment: "Status 1: normal 2: ban | 状态 1 正常 2 禁用", Default: 1},
  425. {Name: "deleted_at", Type: field.TypeTime, Nullable: true, Comment: "Delete Time | 删除日期"},
  426. {Name: "port", Type: field.TypeString, Comment: "端口号", Default: ""},
  427. {Name: "process_id", Type: field.TypeString, Comment: "进程号", Default: ""},
  428. {Name: "callback", Type: field.TypeString, Comment: "回调地址", Default: ""},
  429. {Name: "wxid", Type: field.TypeString, Comment: "微信id", Default: ""},
  430. {Name: "account", Type: field.TypeString, Comment: "微信账号", Default: ""},
  431. {Name: "nickname", Type: field.TypeString, Comment: "微信昵称", Default: ""},
  432. {Name: "tel", Type: field.TypeString, Comment: "手机号", Default: ""},
  433. {Name: "head_big", Type: field.TypeString, Comment: "微信头像", Default: ""},
  434. {Name: "organization_id", Type: field.TypeUint64, Nullable: true, Comment: "机构 ID", Default: 1},
  435. {Name: "server_id", Type: field.TypeUint64, Nullable: true, Comment: "服务器id", Default: 0},
  436. }
  437. // WxTable holds the schema information for the "wx" table.
  438. WxTable = &schema.Table{
  439. Name: "wx",
  440. Columns: WxColumns,
  441. PrimaryKey: []*schema.Column{WxColumns[0]},
  442. ForeignKeys: []*schema.ForeignKey{
  443. {
  444. Symbol: "wx_server_wxs",
  445. Columns: []*schema.Column{WxColumns[14]},
  446. RefColumns: []*schema.Column{ServerColumns[0]},
  447. OnDelete: schema.SetNull,
  448. },
  449. },
  450. Indexes: []*schema.Index{
  451. {
  452. Name: "wx_server_id_port",
  453. Unique: true,
  454. Columns: []*schema.Column{WxColumns[14], WxColumns[5]},
  455. },
  456. {
  457. Name: "wx_wxid",
  458. Unique: true,
  459. Columns: []*schema.Column{WxColumns[8]},
  460. },
  461. {
  462. Name: "wx_account",
  463. Unique: false,
  464. Columns: []*schema.Column{WxColumns[9]},
  465. },
  466. {
  467. Name: "wx_nickname",
  468. Unique: false,
  469. Columns: []*schema.Column{WxColumns[10]},
  470. },
  471. {
  472. Name: "wx_tel",
  473. Unique: false,
  474. Columns: []*schema.Column{WxColumns[11]},
  475. },
  476. },
  477. }
  478. // Tables holds all the tables in the schema.
  479. Tables = []*schema.Table{
  480. AgentTable,
  481. BatchMsgTable,
  482. ContactTable,
  483. LabelTable,
  484. LabelRelationshipTable,
  485. MessagesTable,
  486. MessageRecordsTable,
  487. MsgTable,
  488. ServerTable,
  489. SopNodeTable,
  490. SopStageTable,
  491. SopTaskTable,
  492. WxTable,
  493. }
  494. )
  495. func init() {
  496. AgentTable.Annotation = &entsql.Annotation{
  497. Table: "agent",
  498. }
  499. BatchMsgTable.Annotation = &entsql.Annotation{
  500. Table: "batch_msg",
  501. }
  502. ContactTable.Annotation = &entsql.Annotation{
  503. Table: "contact",
  504. }
  505. LabelTable.Annotation = &entsql.Annotation{
  506. Table: "label",
  507. }
  508. LabelRelationshipTable.ForeignKeys[0].RefTable = ContactTable
  509. LabelRelationshipTable.ForeignKeys[1].RefTable = LabelTable
  510. LabelRelationshipTable.Annotation = &entsql.Annotation{
  511. Table: "label_relationship",
  512. }
  513. MessagesTable.Annotation = &entsql.Annotation{
  514. Table: "messages",
  515. }
  516. MessageRecordsTable.ForeignKeys[0].RefTable = ContactTable
  517. MessageRecordsTable.ForeignKeys[1].RefTable = SopNodeTable
  518. MessageRecordsTable.ForeignKeys[2].RefTable = SopStageTable
  519. MessageRecordsTable.Annotation = &entsql.Annotation{
  520. Table: "message_records",
  521. }
  522. MsgTable.Annotation = &entsql.Annotation{
  523. Table: "msg",
  524. }
  525. ServerTable.Annotation = &entsql.Annotation{
  526. Table: "server",
  527. }
  528. SopNodeTable.ForeignKeys[0].RefTable = SopStageTable
  529. SopNodeTable.Annotation = &entsql.Annotation{
  530. Table: "sop_node",
  531. }
  532. SopStageTable.ForeignKeys[0].RefTable = SopTaskTable
  533. SopStageTable.Annotation = &entsql.Annotation{
  534. Table: "sop_stage",
  535. }
  536. SopTaskTable.Annotation = &entsql.Annotation{
  537. Table: "sop_task",
  538. }
  539. WxTable.ForeignKeys[0].RefTable = ServerTable
  540. WxTable.Annotation = &entsql.Annotation{
  541. Table: "wx",
  542. }
  543. }