schema.go 26 KB

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