schema.go 35 KB

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