schema.go 25 KB

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