schema.go 36 KB

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