schema.go 24 KB

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