schema.go 37 KB

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