schema.go 35 KB

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