schema.go 25 KB

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