schema.go 34 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742
  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: 255, 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: "type", Type: field.TypeInt32, Nullable: true, Comment: "发送类型 1-群发消息 2-群发朋友圈"},
  53. {Name: "organization_id", Type: field.TypeUint64, Comment: "organization_id | 租户ID"},
  54. }
  55. // BatchMsgTable holds the schema information for the "batch_msg" table.
  56. BatchMsgTable = &schema.Table{
  57. Name: "batch_msg",
  58. Columns: BatchMsgColumns,
  59. PrimaryKey: []*schema.Column{BatchMsgColumns[0]},
  60. Indexes: []*schema.Index{
  61. {
  62. Name: "batchmsg_batch_no",
  63. Unique: true,
  64. Columns: []*schema.Column{BatchMsgColumns[5]},
  65. },
  66. {
  67. Name: "batchmsg_type",
  68. Unique: false,
  69. Columns: []*schema.Column{BatchMsgColumns[15]},
  70. },
  71. },
  72. }
  73. // ContactColumns holds the columns for the "contact" table.
  74. ContactColumns = []*schema.Column{
  75. {Name: "id", Type: field.TypeUint64, Increment: true},
  76. {Name: "created_at", Type: field.TypeTime, Comment: "Create Time | 创建日期"},
  77. {Name: "updated_at", Type: field.TypeTime, Comment: "Update Time | 修改日期"},
  78. {Name: "status", Type: field.TypeUint8, Nullable: true, Comment: "Status 1: normal 2: ban | 状态 1 正常 2 禁用", Default: 1},
  79. {Name: "deleted_at", Type: field.TypeTime, Nullable: true, Comment: "Delete Time | 删除日期"},
  80. {Name: "wx_wxid", Type: field.TypeString, Nullable: true, Comment: "属主微信id", Default: ""},
  81. {Name: "type", Type: field.TypeInt, Nullable: true, Comment: "联系人类型:1好友,2群组,3公众号,4企业微信联系人", Default: 1},
  82. {Name: "wxid", Type: field.TypeString, Comment: "微信id 公众号微信ID", Default: ""},
  83. {Name: "account", Type: field.TypeString, Comment: "微信账号", Default: ""},
  84. {Name: "nickname", Type: field.TypeString, Comment: "微信昵称 群备注名称", Default: ""},
  85. {Name: "markname", Type: field.TypeString, Comment: "备注名", Default: ""},
  86. {Name: "headimg", Type: field.TypeString, Comment: "头像", Default: ""},
  87. {Name: "sex", Type: field.TypeInt, Comment: "性别 0未知 1男 2女", Default: 0},
  88. {Name: "starrole", Type: field.TypeString, Comment: "星标 65/67=星标 1/3=未星标", Default: ""},
  89. {Name: "dontseeit", Type: field.TypeInt, Comment: "不让他看我的朋友圈 0可以看 1不让看", Default: 0},
  90. {Name: "dontseeme", Type: field.TypeInt, Comment: "不看他的朋友圈 0可以看 1不看 1=开启了不看他 128/129=仅聊天", Default: 0},
  91. {Name: "lag", Type: field.TypeString, Comment: "所属标签id清单,多开会用逗号隔开", Default: ""},
  92. {Name: "gid", Type: field.TypeString, Comment: "群组id", Default: ""},
  93. {Name: "gname", Type: field.TypeString, Comment: "群组名称", Default: ""},
  94. {Name: "v3", Type: field.TypeString, Comment: "v3数据", Default: ""},
  95. {Name: "organization_id", Type: field.TypeUint64, Nullable: true, Comment: "机构 ID", Default: 1},
  96. }
  97. // ContactTable holds the schema information for the "contact" table.
  98. ContactTable = &schema.Table{
  99. Name: "contact",
  100. Columns: ContactColumns,
  101. PrimaryKey: []*schema.Column{ContactColumns[0]},
  102. Indexes: []*schema.Index{
  103. {
  104. Name: "contact_wx_wxid_wxid",
  105. Unique: true,
  106. Columns: []*schema.Column{ContactColumns[5], ContactColumns[7]},
  107. },
  108. {
  109. Name: "contact_wxid",
  110. Unique: false,
  111. Columns: []*schema.Column{ContactColumns[7]},
  112. },
  113. {
  114. Name: "contact_type",
  115. Unique: false,
  116. Columns: []*schema.Column{ContactColumns[6]},
  117. },
  118. {
  119. Name: "contact_gid",
  120. Unique: false,
  121. Columns: []*schema.Column{ContactColumns[17]},
  122. },
  123. },
  124. }
  125. // EmployeeColumns holds the columns for the "employee" table.
  126. EmployeeColumns = []*schema.Column{
  127. {Name: "id", Type: field.TypeUint64, Increment: true},
  128. {Name: "created_at", Type: field.TypeTime, Comment: "Create Time | 创建日期"},
  129. {Name: "updated_at", Type: field.TypeTime, Comment: "Update Time | 修改日期"},
  130. {Name: "deleted_at", Type: field.TypeTime, Nullable: true, Comment: "Delete Time | 删除日期"},
  131. {Name: "title", Type: field.TypeString, Size: 255, Comment: "title | 标题"},
  132. {Name: "avatar", Type: field.TypeString, Size: 1000, Comment: "avatar | 头像"},
  133. {Name: "tags", Type: field.TypeString, Size: 255, Comment: "tags | 个人标签"},
  134. {Name: "hire_count", Type: field.TypeInt, Comment: "hire_count | 被雇佣次数", Default: 0},
  135. {Name: "service_count", Type: field.TypeInt, Comment: "service_count | 已服务次数", Default: 0},
  136. {Name: "achievement_count", Type: field.TypeInt, Comment: "achievement_count | 业绩单数", Default: 0},
  137. {Name: "intro", Type: field.TypeString, Size: 1000, Comment: "intro | 个人介绍", Default: ""},
  138. {Name: "estimate", Type: field.TypeString, Size: 1000, Comment: "estimate | 自我评价", Default: ""},
  139. {Name: "skill", Type: field.TypeString, Size: 1000, Comment: "skill | 技能卡", Default: ""},
  140. {Name: "ability_type", Type: field.TypeString, Comment: "ability_type | 能力类型", Default: ""},
  141. {Name: "scene", Type: field.TypeString, Comment: "scene | 使用场景", Default: ""},
  142. {Name: "switch_in", Type: field.TypeString, Comment: "switch_in | 支持介入", Default: ""},
  143. {Name: "video_url", Type: field.TypeString, Size: 1000, Comment: "video_url | 视频地址", Default: ""},
  144. {Name: "organization_id", Type: field.TypeUint64, Comment: "organization_id | 租户ID"},
  145. }
  146. // EmployeeTable holds the schema information for the "employee" table.
  147. EmployeeTable = &schema.Table{
  148. Name: "employee",
  149. Columns: EmployeeColumns,
  150. PrimaryKey: []*schema.Column{EmployeeColumns[0]},
  151. Indexes: []*schema.Index{
  152. {
  153. Name: "employee_organization_id",
  154. Unique: false,
  155. Columns: []*schema.Column{EmployeeColumns[17]},
  156. },
  157. },
  158. }
  159. // EmployeeConfigColumns holds the columns for the "employee_config" table.
  160. EmployeeConfigColumns = []*schema.Column{
  161. {Name: "id", Type: field.TypeUint64, Increment: true},
  162. {Name: "created_at", Type: field.TypeTime, Comment: "Create Time | 创建日期"},
  163. {Name: "updated_at", Type: field.TypeTime, Comment: "Update Time | 修改日期"},
  164. {Name: "deleted_at", Type: field.TypeTime, Nullable: true, Comment: "Delete Time | 删除日期"},
  165. {Name: "stype", Type: field.TypeString, Comment: "类型:scene-场景 switch_in-接入方式", Default: ""},
  166. {Name: "title", Type: field.TypeString, Comment: "标题", Default: ""},
  167. {Name: "photo", Type: field.TypeString, Comment: "图片地址", Default: ""},
  168. {Name: "organization_id", Type: field.TypeUint64, Nullable: true, Comment: "机构 ID", Default: 1},
  169. }
  170. // EmployeeConfigTable holds the schema information for the "employee_config" table.
  171. EmployeeConfigTable = &schema.Table{
  172. Name: "employee_config",
  173. Columns: EmployeeConfigColumns,
  174. PrimaryKey: []*schema.Column{EmployeeConfigColumns[0]},
  175. Indexes: []*schema.Index{
  176. {
  177. Name: "employeeconfig_stype",
  178. Unique: false,
  179. Columns: []*schema.Column{EmployeeConfigColumns[4]},
  180. },
  181. },
  182. }
  183. // LabelColumns holds the columns for the "label" table.
  184. LabelColumns = []*schema.Column{
  185. {Name: "id", Type: field.TypeUint64, Increment: true},
  186. {Name: "created_at", Type: field.TypeTime, Comment: "Create Time | 创建日期"},
  187. {Name: "updated_at", Type: field.TypeTime, Comment: "Update Time | 修改日期"},
  188. {Name: "status", Type: field.TypeUint8, Nullable: true, Comment: "Status 1: normal 2: ban | 状态 1 正常 2 禁用", Default: 1},
  189. {Name: "type", Type: field.TypeInt, Comment: "标签类型:1好友,2群组,3公众号,4企业微信联系人", Default: 1},
  190. {Name: "name", Type: field.TypeString, Comment: "标签名称", Default: ""},
  191. {Name: "from", Type: field.TypeInt, Comment: "标签来源:1后台创建 2个微同步", Default: 1},
  192. {Name: "mode", Type: field.TypeInt, Comment: "标签模式:1动态 2静态", Default: 1},
  193. {Name: "conditions", Type: field.TypeString, Nullable: true, Comment: "标签的触达条件", Default: ""},
  194. {Name: "organization_id", Type: field.TypeUint64, Nullable: true, Comment: "机构 ID", Default: 1},
  195. }
  196. // LabelTable holds the schema information for the "label" table.
  197. LabelTable = &schema.Table{
  198. Name: "label",
  199. Columns: LabelColumns,
  200. PrimaryKey: []*schema.Column{LabelColumns[0]},
  201. Indexes: []*schema.Index{
  202. {
  203. Name: "label_name_from_mode",
  204. Unique: true,
  205. Columns: []*schema.Column{LabelColumns[5], LabelColumns[6], LabelColumns[7]},
  206. },
  207. },
  208. }
  209. // LabelRelationshipColumns holds the columns for the "label_relationship" table.
  210. LabelRelationshipColumns = []*schema.Column{
  211. {Name: "id", Type: field.TypeUint64, Increment: true},
  212. {Name: "created_at", Type: field.TypeTime, Comment: "Create Time | 创建日期"},
  213. {Name: "updated_at", Type: field.TypeTime, Comment: "Update Time | 修改日期"},
  214. {Name: "status", Type: field.TypeUint8, Nullable: true, Comment: "Status 1: normal 2: ban | 状态 1 正常 2 禁用", Default: 1},
  215. {Name: "deleted_at", Type: field.TypeTime, Nullable: true, Comment: "Delete Time | 删除日期"},
  216. {Name: "organization_id", Type: field.TypeUint64, Nullable: true, Comment: "机构 ID", Default: 1},
  217. {Name: "contact_id", Type: field.TypeUint64, Comment: "联系人 ID", Default: 1},
  218. {Name: "label_id", Type: field.TypeUint64, Comment: "标签 ID", Default: 1},
  219. }
  220. // LabelRelationshipTable holds the schema information for the "label_relationship" table.
  221. LabelRelationshipTable = &schema.Table{
  222. Name: "label_relationship",
  223. Columns: LabelRelationshipColumns,
  224. PrimaryKey: []*schema.Column{LabelRelationshipColumns[0]},
  225. ForeignKeys: []*schema.ForeignKey{
  226. {
  227. Symbol: "label_relationship_contact_contact_relationships",
  228. Columns: []*schema.Column{LabelRelationshipColumns[6]},
  229. RefColumns: []*schema.Column{ContactColumns[0]},
  230. OnDelete: schema.NoAction,
  231. },
  232. {
  233. Symbol: "label_relationship_label_label_relationships",
  234. Columns: []*schema.Column{LabelRelationshipColumns[7]},
  235. RefColumns: []*schema.Column{LabelColumns[0]},
  236. OnDelete: schema.NoAction,
  237. },
  238. },
  239. Indexes: []*schema.Index{
  240. {
  241. Name: "labelrelationship_label_id",
  242. Unique: false,
  243. Columns: []*schema.Column{LabelRelationshipColumns[7]},
  244. },
  245. {
  246. Name: "labelrelationship_contact_id",
  247. Unique: false,
  248. Columns: []*schema.Column{LabelRelationshipColumns[6]},
  249. },
  250. },
  251. }
  252. // MessagesColumns holds the columns for the "messages" table.
  253. MessagesColumns = []*schema.Column{
  254. {Name: "id", Type: field.TypeInt, Increment: true},
  255. {Name: "wx_wxid", Type: field.TypeString, Nullable: true, Comment: "属主微信id", Default: ""},
  256. {Name: "wxid", Type: field.TypeString, Comment: "微信id 公众号微信ID", Default: ""},
  257. {Name: "content", Type: field.TypeString, Comment: "微信消息内容", Default: ""},
  258. }
  259. // MessagesTable holds the schema information for the "messages" table.
  260. MessagesTable = &schema.Table{
  261. Name: "messages",
  262. Columns: MessagesColumns,
  263. PrimaryKey: []*schema.Column{MessagesColumns[0]},
  264. }
  265. // MessageRecordsColumns holds the columns for the "message_records" table.
  266. MessageRecordsColumns = []*schema.Column{
  267. {Name: "id", Type: field.TypeUint64, Increment: true},
  268. {Name: "created_at", Type: field.TypeTime, Comment: "Create Time | 创建日期"},
  269. {Name: "updated_at", Type: field.TypeTime, Comment: "Update Time | 修改日期"},
  270. {Name: "status", Type: field.TypeUint8, Nullable: true, Comment: "Status 1: normal 2: ban | 状态 1 正常 2 禁用", Default: 1},
  271. {Name: "deleted_at", Type: field.TypeTime, Nullable: true, Comment: "Delete Time | 删除日期"},
  272. {Name: "bot_wxid", Type: field.TypeString, Comment: "机器人微信 id"},
  273. {Name: "contact_type", Type: field.TypeInt, Comment: "类型:1好友,2群组,3企业微信联系人", Default: 1},
  274. {Name: "contact_wxid", Type: field.TypeString, Comment: "接收方微信 id", Default: ""},
  275. {Name: "content_type", Type: field.TypeInt, Comment: "内容类型 1 文本 2 文件", Default: 1},
  276. {Name: "content", Type: field.TypeString, Comment: "发送内容", Default: ""},
  277. {Name: "meta", Type: field.TypeJSON, Nullable: true, Comment: "元数据"},
  278. {Name: "error_detail", Type: field.TypeString, Comment: "异常原因", Default: ""},
  279. {Name: "send_time", Type: field.TypeTime, Nullable: true, Comment: "发送时间"},
  280. {Name: "source_type", Type: field.TypeInt, Comment: "源类型 1 点发 2 群发 3 SOP", Default: 1},
  281. {Name: "organization_id", Type: field.TypeUint64, Nullable: true, Comment: "机构 ID", Default: 1},
  282. {Name: "contact_id", Type: field.TypeUint64, Nullable: true, Comment: "联系人 id"},
  283. {Name: "sub_source_id", Type: field.TypeUint64, Nullable: true, Comment: "次源 ID", Default: 1},
  284. {Name: "source_id", Type: field.TypeUint64, Nullable: true, Comment: "源 ID", Default: 1},
  285. }
  286. // MessageRecordsTable holds the schema information for the "message_records" table.
  287. MessageRecordsTable = &schema.Table{
  288. Name: "message_records",
  289. Columns: MessageRecordsColumns,
  290. PrimaryKey: []*schema.Column{MessageRecordsColumns[0]},
  291. ForeignKeys: []*schema.ForeignKey{
  292. {
  293. Symbol: "message_records_contact_contact_messages",
  294. Columns: []*schema.Column{MessageRecordsColumns[15]},
  295. RefColumns: []*schema.Column{ContactColumns[0]},
  296. OnDelete: schema.SetNull,
  297. },
  298. {
  299. Symbol: "message_records_sop_node_node_messages",
  300. Columns: []*schema.Column{MessageRecordsColumns[16]},
  301. RefColumns: []*schema.Column{SopNodeColumns[0]},
  302. OnDelete: schema.SetNull,
  303. },
  304. {
  305. Symbol: "message_records_sop_stage_stage_messages",
  306. Columns: []*schema.Column{MessageRecordsColumns[17]},
  307. RefColumns: []*schema.Column{SopStageColumns[0]},
  308. OnDelete: schema.SetNull,
  309. },
  310. },
  311. Indexes: []*schema.Index{
  312. {
  313. Name: "messagerecords_source_type",
  314. Unique: false,
  315. Columns: []*schema.Column{MessageRecordsColumns[13]},
  316. },
  317. },
  318. }
  319. // MsgColumns holds the columns for the "msg" table.
  320. MsgColumns = []*schema.Column{
  321. {Name: "id", Type: field.TypeUint64, Increment: true},
  322. {Name: "created_at", Type: field.TypeTime, Comment: "Create Time | 创建日期"},
  323. {Name: "updated_at", Type: field.TypeTime, Comment: "Update Time | 修改日期"},
  324. {Name: "deleted_at", Type: field.TypeTime, Nullable: true, Comment: "Delete Time | 删除日期"},
  325. {Name: "status", Type: field.TypeUint8, Nullable: true, Comment: "Status 1: normal 2: ban | 状态 1 正常 2 禁用"},
  326. {Name: "fromwxid", Type: field.TypeString, Nullable: true, Comment: "发送方微信ID"},
  327. {Name: "toid", Type: field.TypeString, Nullable: true, Comment: "接收人微信ID/群ID"},
  328. {Name: "msgtype", Type: field.TypeInt32, Nullable: true, Comment: "消息类型"},
  329. {Name: "msg", Type: field.TypeString, Nullable: true, Comment: "消息"},
  330. {Name: "batch_no", Type: field.TypeString, Nullable: true, Comment: "批次号"},
  331. }
  332. // MsgTable holds the schema information for the "msg" table.
  333. MsgTable = &schema.Table{
  334. Name: "msg",
  335. Columns: MsgColumns,
  336. PrimaryKey: []*schema.Column{MsgColumns[0]},
  337. Indexes: []*schema.Index{
  338. {
  339. Name: "msg_batch_no",
  340. Unique: false,
  341. Columns: []*schema.Column{MsgColumns[9]},
  342. },
  343. {
  344. Name: "msg_id",
  345. Unique: false,
  346. Columns: []*schema.Column{MsgColumns[0]},
  347. },
  348. {
  349. Name: "msg_status",
  350. Unique: false,
  351. Columns: []*schema.Column{MsgColumns[4]},
  352. },
  353. },
  354. }
  355. // ServerColumns holds the columns for the "server" table.
  356. ServerColumns = []*schema.Column{
  357. {Name: "id", Type: field.TypeUint64, Increment: true},
  358. {Name: "created_at", Type: field.TypeTime, Comment: "Create Time | 创建日期"},
  359. {Name: "updated_at", Type: field.TypeTime, Comment: "Update Time | 修改日期"},
  360. {Name: "status", Type: field.TypeUint8, Nullable: true, Comment: "Status 1: normal 2: ban | 状态 1 正常 2 禁用", Default: 1},
  361. {Name: "deleted_at", Type: field.TypeTime, Nullable: true, Comment: "Delete Time | 删除日期"},
  362. {Name: "name", Type: field.TypeString, Comment: "名称"},
  363. {Name: "public_ip", Type: field.TypeString, Comment: "公网ip"},
  364. {Name: "private_ip", Type: field.TypeString, Comment: "内网ip"},
  365. {Name: "admin_port", Type: field.TypeString, Comment: "管理端口"},
  366. }
  367. // ServerTable holds the schema information for the "server" table.
  368. ServerTable = &schema.Table{
  369. Name: "server",
  370. Columns: ServerColumns,
  371. PrimaryKey: []*schema.Column{ServerColumns[0]},
  372. Indexes: []*schema.Index{
  373. {
  374. Name: "server_name",
  375. Unique: false,
  376. Columns: []*schema.Column{ServerColumns[5]},
  377. },
  378. {
  379. Name: "server_private_ip",
  380. Unique: false,
  381. Columns: []*schema.Column{ServerColumns[7]},
  382. },
  383. {
  384. Name: "server_public_ip",
  385. Unique: true,
  386. Columns: []*schema.Column{ServerColumns[6]},
  387. },
  388. },
  389. }
  390. // SopNodeColumns holds the columns for the "sop_node" table.
  391. SopNodeColumns = []*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: "parent_id", Type: field.TypeUint64, Comment: "父节点 ID"},
  398. {Name: "name", Type: field.TypeString, Comment: "节点名称", Default: ""},
  399. {Name: "condition_type", Type: field.TypeInt, Comment: "触发条件类型 1 客户回复后触发 2 超时后触发", Default: 1},
  400. {Name: "condition_list", Type: field.TypeJSON, Nullable: true, Comment: "触发语义列表 当为空时则代表用户回复任意内容后触发"},
  401. {Name: "no_reply_condition", Type: field.TypeUint64, Comment: "超时触发时间(分钟)", Default: 0},
  402. {Name: "action_message", Type: field.TypeJSON, Nullable: true, Comment: "命中后发送的消息内容"},
  403. {Name: "action_label", Type: field.TypeJSON, Nullable: true, Comment: "命中后需要打的标签"},
  404. {Name: "stage_id", Type: field.TypeUint64, Comment: "阶段 ID"},
  405. }
  406. // SopNodeTable holds the schema information for the "sop_node" table.
  407. SopNodeTable = &schema.Table{
  408. Name: "sop_node",
  409. Columns: SopNodeColumns,
  410. PrimaryKey: []*schema.Column{SopNodeColumns[0]},
  411. ForeignKeys: []*schema.ForeignKey{
  412. {
  413. Symbol: "sop_node_sop_stage_stage_nodes",
  414. Columns: []*schema.Column{SopNodeColumns[12]},
  415. RefColumns: []*schema.Column{SopStageColumns[0]},
  416. OnDelete: schema.NoAction,
  417. },
  418. },
  419. Indexes: []*schema.Index{
  420. {
  421. Name: "sopnode_name",
  422. Unique: false,
  423. Columns: []*schema.Column{SopNodeColumns[6]},
  424. },
  425. },
  426. }
  427. // SopStageColumns holds the columns for the "sop_stage" table.
  428. SopStageColumns = []*schema.Column{
  429. {Name: "id", Type: field.TypeUint64, Increment: true},
  430. {Name: "created_at", Type: field.TypeTime, Comment: "Create Time | 创建日期"},
  431. {Name: "updated_at", Type: field.TypeTime, Comment: "Update Time | 修改日期"},
  432. {Name: "status", Type: field.TypeUint8, Nullable: true, Comment: "Status 1: normal 2: ban | 状态 1 正常 2 禁用", Default: 1},
  433. {Name: "deleted_at", Type: field.TypeTime, Nullable: true, Comment: "Delete Time | 删除日期"},
  434. {Name: "name", Type: field.TypeString, Comment: "阶段名称", Default: ""},
  435. {Name: "condition_type", Type: field.TypeInt, Comment: "客群筛选条件类型 1 按标签筛选 2 按客户基本信息筛选", Default: 1},
  436. {Name: "condition_operator", Type: field.TypeInt, Comment: "筛选条件关系 1 满足所有条件(and) 2 满足任意条件(or)", Default: 1},
  437. {Name: "condition_list", Type: field.TypeJSON, Comment: "筛选条件列表"},
  438. {Name: "action_message", Type: field.TypeJSON, Nullable: true, Comment: "命中后发送的消息内容"},
  439. {Name: "action_label", Type: field.TypeJSON, Nullable: true, Comment: "命中后需要打的标签"},
  440. {Name: "index_sort", Type: field.TypeInt, Nullable: true, Comment: "阶段顺序", Default: 1},
  441. {Name: "task_id", Type: field.TypeUint64, Comment: "SOP 任务 ID"},
  442. }
  443. // SopStageTable holds the schema information for the "sop_stage" table.
  444. SopStageTable = &schema.Table{
  445. Name: "sop_stage",
  446. Columns: SopStageColumns,
  447. PrimaryKey: []*schema.Column{SopStageColumns[0]},
  448. ForeignKeys: []*schema.ForeignKey{
  449. {
  450. Symbol: "sop_stage_sop_task_task_stages",
  451. Columns: []*schema.Column{SopStageColumns[12]},
  452. RefColumns: []*schema.Column{SopTaskColumns[0]},
  453. OnDelete: schema.NoAction,
  454. },
  455. },
  456. Indexes: []*schema.Index{
  457. {
  458. Name: "sopstage_name",
  459. Unique: false,
  460. Columns: []*schema.Column{SopStageColumns[5]},
  461. },
  462. },
  463. }
  464. // SopTaskColumns holds the columns for the "sop_task" table.
  465. SopTaskColumns = []*schema.Column{
  466. {Name: "id", Type: field.TypeUint64, Increment: true},
  467. {Name: "created_at", Type: field.TypeTime, Comment: "Create Time | 创建日期"},
  468. {Name: "updated_at", Type: field.TypeTime, Comment: "Update Time | 修改日期"},
  469. {Name: "status", Type: field.TypeUint8, Nullable: true, Comment: "Status 1: normal 2: ban | 状态 1 正常 2 禁用", Default: 1},
  470. {Name: "deleted_at", Type: field.TypeTime, Nullable: true, Comment: "Delete Time | 删除日期"},
  471. {Name: "name", Type: field.TypeString, Comment: "SOP 任务名称"},
  472. {Name: "bot_wxid_list", Type: field.TypeJSON, Nullable: true, Comment: "机器人微信 id 列表"},
  473. {Name: "type", Type: field.TypeInt, Comment: "标签类型:1好友,2群组,3企业微信联系人", Default: 1},
  474. {Name: "plan_start_time", Type: field.TypeTime, Nullable: true, Comment: "任务计划开始时间"},
  475. {Name: "plan_end_time", Type: field.TypeTime, Nullable: true, Comment: "任务计划结束时间"},
  476. {Name: "creator_id", Type: field.TypeString, Nullable: true, Comment: "创建者 id"},
  477. {Name: "organization_id", Type: field.TypeUint64, Nullable: true, Comment: "机构 ID", Default: 1},
  478. }
  479. // SopTaskTable holds the schema information for the "sop_task" table.
  480. SopTaskTable = &schema.Table{
  481. Name: "sop_task",
  482. Columns: SopTaskColumns,
  483. PrimaryKey: []*schema.Column{SopTaskColumns[0]},
  484. Indexes: []*schema.Index{
  485. {
  486. Name: "soptask_name",
  487. Unique: false,
  488. Columns: []*schema.Column{SopTaskColumns[5]},
  489. },
  490. },
  491. }
  492. // TokenColumns holds the columns for the "token" table.
  493. TokenColumns = []*schema.Column{
  494. {Name: "id", Type: field.TypeUint64, Increment: true},
  495. {Name: "created_at", Type: field.TypeTime, Comment: "Create Time | 创建日期"},
  496. {Name: "updated_at", Type: field.TypeTime, Comment: "Update Time | 修改日期"},
  497. {Name: "deleted_at", Type: field.TypeTime, Nullable: true, Comment: "Delete Time | 删除日期"},
  498. {Name: "expire_at", Type: field.TypeTime, Nullable: true, Comment: "过期时间"},
  499. {Name: "token", Type: field.TypeString, Nullable: true, Comment: "Token", Default: ""},
  500. {Name: "mac", Type: field.TypeString, Comment: "Mac地址", Default: ""},
  501. }
  502. // TokenTable holds the schema information for the "token" table.
  503. TokenTable = &schema.Table{
  504. Name: "token",
  505. Columns: TokenColumns,
  506. PrimaryKey: []*schema.Column{TokenColumns[0]},
  507. Indexes: []*schema.Index{
  508. {
  509. Name: "token_token",
  510. Unique: true,
  511. Columns: []*schema.Column{TokenColumns[5]},
  512. },
  513. },
  514. }
  515. // TutorialColumns holds the columns for the "tutorial" table.
  516. TutorialColumns = []*schema.Column{
  517. {Name: "id", Type: field.TypeUint64, Increment: true},
  518. {Name: "created_at", Type: field.TypeTime, Comment: "Create Time | 创建日期"},
  519. {Name: "updated_at", Type: field.TypeTime, Comment: "Update Time | 修改日期"},
  520. {Name: "deleted_at", Type: field.TypeTime, Nullable: true, Comment: "Delete Time | 删除日期"},
  521. {Name: "index", Type: field.TypeInt, Comment: "index | 序号"},
  522. {Name: "title", Type: field.TypeString, Comment: "title | 标题"},
  523. {Name: "content", Type: field.TypeString, Comment: "content | 内容"},
  524. {Name: "organization_id", Type: field.TypeUint64, Comment: "organization_id | 租户ID"},
  525. {Name: "employee_id", Type: field.TypeUint64, Comment: "employee_id | 员工ID"},
  526. }
  527. // TutorialTable holds the schema information for the "tutorial" table.
  528. TutorialTable = &schema.Table{
  529. Name: "tutorial",
  530. Columns: TutorialColumns,
  531. PrimaryKey: []*schema.Column{TutorialColumns[0]},
  532. ForeignKeys: []*schema.ForeignKey{
  533. {
  534. Symbol: "tutorial_employee_em_tutorial",
  535. Columns: []*schema.Column{TutorialColumns[8]},
  536. RefColumns: []*schema.Column{EmployeeColumns[0]},
  537. OnDelete: schema.NoAction,
  538. },
  539. },
  540. Indexes: []*schema.Index{
  541. {
  542. Name: "tutorial_employee_id",
  543. Unique: false,
  544. Columns: []*schema.Column{TutorialColumns[8]},
  545. },
  546. },
  547. }
  548. // WorkExperienceColumns holds the columns for the "work_experience" table.
  549. WorkExperienceColumns = []*schema.Column{
  550. {Name: "id", Type: field.TypeUint64, Increment: true},
  551. {Name: "created_at", Type: field.TypeTime, Comment: "Create Time | 创建日期"},
  552. {Name: "updated_at", Type: field.TypeTime, Comment: "Update Time | 修改日期"},
  553. {Name: "deleted_at", Type: field.TypeTime, Nullable: true, Comment: "Delete Time | 删除日期"},
  554. {Name: "start_date", Type: field.TypeTime, Comment: "start_date | 开始时间"},
  555. {Name: "end_date", Type: field.TypeTime, Comment: "end_date | 结束时间"},
  556. {Name: "company", Type: field.TypeString, Comment: "company | 公司名"},
  557. {Name: "experience", Type: field.TypeString, Size: 2147483647, Comment: "experience | 工作内容"},
  558. {Name: "organization_id", Type: field.TypeUint64, Comment: "organization_id | 租户ID"},
  559. {Name: "employee_id", Type: field.TypeUint64, Comment: "employee_id | 员工ID"},
  560. }
  561. // WorkExperienceTable holds the schema information for the "work_experience" table.
  562. WorkExperienceTable = &schema.Table{
  563. Name: "work_experience",
  564. Columns: WorkExperienceColumns,
  565. PrimaryKey: []*schema.Column{WorkExperienceColumns[0]},
  566. ForeignKeys: []*schema.ForeignKey{
  567. {
  568. Symbol: "work_experience_employee_em_work_experiences",
  569. Columns: []*schema.Column{WorkExperienceColumns[9]},
  570. RefColumns: []*schema.Column{EmployeeColumns[0]},
  571. OnDelete: schema.NoAction,
  572. },
  573. },
  574. Indexes: []*schema.Index{
  575. {
  576. Name: "workexperience_employee_id",
  577. Unique: false,
  578. Columns: []*schema.Column{WorkExperienceColumns[9]},
  579. },
  580. },
  581. }
  582. // WxColumns holds the columns for the "wx" table.
  583. WxColumns = []*schema.Column{
  584. {Name: "id", Type: field.TypeUint64, Increment: true},
  585. {Name: "created_at", Type: field.TypeTime, Comment: "Create Time | 创建日期"},
  586. {Name: "updated_at", Type: field.TypeTime, Comment: "Update Time | 修改日期"},
  587. {Name: "status", Type: field.TypeUint8, Nullable: true, Comment: "Status 1: normal 2: ban | 状态 1 正常 2 禁用", Default: 1},
  588. {Name: "deleted_at", Type: field.TypeTime, Nullable: true, Comment: "Delete Time | 删除日期"},
  589. {Name: "port", Type: field.TypeString, Comment: "端口号", Default: ""},
  590. {Name: "process_id", Type: field.TypeString, Comment: "进程号", Default: ""},
  591. {Name: "callback", Type: field.TypeString, Comment: "回调地址", Default: ""},
  592. {Name: "wxid", Type: field.TypeString, Comment: "微信id", Default: ""},
  593. {Name: "account", Type: field.TypeString, Comment: "微信账号", Default: ""},
  594. {Name: "nickname", Type: field.TypeString, Comment: "微信昵称", Default: ""},
  595. {Name: "tel", Type: field.TypeString, Comment: "手机号", Default: ""},
  596. {Name: "head_big", Type: field.TypeString, Comment: "微信头像", Default: ""},
  597. {Name: "organization_id", Type: field.TypeUint64, Nullable: true, Comment: "机构 ID", Default: 1},
  598. {Name: "api_base", Type: field.TypeString, Nullable: true, Comment: "大模型服务地址", Default: ""},
  599. {Name: "api_key", Type: field.TypeString, Nullable: true, Comment: "大模型服务密钥", Default: ""},
  600. {Name: "agent_id", Type: field.TypeUint64, Comment: "模式ID", Default: 0},
  601. {Name: "server_id", Type: field.TypeUint64, Nullable: true, Comment: "服务器id", Default: 0},
  602. }
  603. // WxTable holds the schema information for the "wx" table.
  604. WxTable = &schema.Table{
  605. Name: "wx",
  606. Columns: WxColumns,
  607. PrimaryKey: []*schema.Column{WxColumns[0]},
  608. ForeignKeys: []*schema.ForeignKey{
  609. {
  610. Symbol: "wx_agent_wx_agent",
  611. Columns: []*schema.Column{WxColumns[16]},
  612. RefColumns: []*schema.Column{AgentColumns[0]},
  613. OnDelete: schema.NoAction,
  614. },
  615. {
  616. Symbol: "wx_server_wxs",
  617. Columns: []*schema.Column{WxColumns[17]},
  618. RefColumns: []*schema.Column{ServerColumns[0]},
  619. OnDelete: schema.SetNull,
  620. },
  621. },
  622. Indexes: []*schema.Index{
  623. {
  624. Name: "wx_server_id_port",
  625. Unique: true,
  626. Columns: []*schema.Column{WxColumns[17], WxColumns[5]},
  627. },
  628. {
  629. Name: "wx_wxid",
  630. Unique: true,
  631. Columns: []*schema.Column{WxColumns[8]},
  632. },
  633. {
  634. Name: "wx_account",
  635. Unique: false,
  636. Columns: []*schema.Column{WxColumns[9]},
  637. },
  638. {
  639. Name: "wx_nickname",
  640. Unique: false,
  641. Columns: []*schema.Column{WxColumns[10]},
  642. },
  643. {
  644. Name: "wx_tel",
  645. Unique: false,
  646. Columns: []*schema.Column{WxColumns[11]},
  647. },
  648. },
  649. }
  650. // Tables holds all the tables in the schema.
  651. Tables = []*schema.Table{
  652. AgentTable,
  653. BatchMsgTable,
  654. ContactTable,
  655. EmployeeTable,
  656. EmployeeConfigTable,
  657. LabelTable,
  658. LabelRelationshipTable,
  659. MessagesTable,
  660. MessageRecordsTable,
  661. MsgTable,
  662. ServerTable,
  663. SopNodeTable,
  664. SopStageTable,
  665. SopTaskTable,
  666. TokenTable,
  667. TutorialTable,
  668. WorkExperienceTable,
  669. WxTable,
  670. }
  671. )
  672. func init() {
  673. AgentTable.Annotation = &entsql.Annotation{
  674. Table: "agent",
  675. }
  676. BatchMsgTable.Annotation = &entsql.Annotation{
  677. Table: "batch_msg",
  678. }
  679. ContactTable.Annotation = &entsql.Annotation{
  680. Table: "contact",
  681. }
  682. EmployeeTable.Annotation = &entsql.Annotation{
  683. Table: "employee",
  684. }
  685. EmployeeConfigTable.Annotation = &entsql.Annotation{
  686. Table: "employee_config",
  687. }
  688. LabelTable.Annotation = &entsql.Annotation{
  689. Table: "label",
  690. }
  691. LabelRelationshipTable.ForeignKeys[0].RefTable = ContactTable
  692. LabelRelationshipTable.ForeignKeys[1].RefTable = LabelTable
  693. LabelRelationshipTable.Annotation = &entsql.Annotation{
  694. Table: "label_relationship",
  695. }
  696. MessagesTable.Annotation = &entsql.Annotation{
  697. Table: "messages",
  698. }
  699. MessageRecordsTable.ForeignKeys[0].RefTable = ContactTable
  700. MessageRecordsTable.ForeignKeys[1].RefTable = SopNodeTable
  701. MessageRecordsTable.ForeignKeys[2].RefTable = SopStageTable
  702. MessageRecordsTable.Annotation = &entsql.Annotation{
  703. Table: "message_records",
  704. }
  705. MsgTable.Annotation = &entsql.Annotation{
  706. Table: "msg",
  707. }
  708. ServerTable.Annotation = &entsql.Annotation{
  709. Table: "server",
  710. }
  711. SopNodeTable.ForeignKeys[0].RefTable = SopStageTable
  712. SopNodeTable.Annotation = &entsql.Annotation{
  713. Table: "sop_node",
  714. }
  715. SopStageTable.ForeignKeys[0].RefTable = SopTaskTable
  716. SopStageTable.Annotation = &entsql.Annotation{
  717. Table: "sop_stage",
  718. }
  719. SopTaskTable.Annotation = &entsql.Annotation{
  720. Table: "sop_task",
  721. }
  722. TokenTable.Annotation = &entsql.Annotation{
  723. Table: "token",
  724. }
  725. TutorialTable.ForeignKeys[0].RefTable = EmployeeTable
  726. TutorialTable.Annotation = &entsql.Annotation{
  727. Table: "tutorial",
  728. }
  729. WorkExperienceTable.ForeignKeys[0].RefTable = EmployeeTable
  730. WorkExperienceTable.Annotation = &entsql.Annotation{
  731. Table: "work_experience",
  732. }
  733. WxTable.ForeignKeys[0].RefTable = AgentTable
  734. WxTable.ForeignKeys[1].RefTable = ServerTable
  735. WxTable.Annotation = &entsql.Annotation{
  736. Table: "wx",
  737. }
  738. }