schema.go 49 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044
  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, Comment: "role | 角色设定"},
  17. {Name: "status", Type: field.TypeInt, Nullable: true, Comment: "status | 状态 1-正常 2-禁用", Default: 1},
  18. {Name: "background", Type: field.TypeString, Nullable: true, Comment: "background | 背景介绍", Default: ""},
  19. {Name: "examples", Type: field.TypeString, Nullable: true, 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. // AliyunAvatarColumns holds the columns for the "aliyun_avatar" table.
  57. AliyunAvatarColumns = []*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: "user_id", Type: field.TypeUint64, Comment: "user_id | wx_card_user_id"},
  63. {Name: "biz_id", Type: field.TypeString, Comment: "biz_id | BizId"},
  64. {Name: "access_key_id", Type: field.TypeString, Comment: "access_key_id | AccessKeyId"},
  65. {Name: "access_key_secret", Type: field.TypeString, Comment: "access_key_secret | AccessKeySecret"},
  66. {Name: "app_id", Type: field.TypeString, Nullable: true, Comment: "app_id | AppId"},
  67. {Name: "tenant_id", Type: field.TypeUint64, Comment: "tenant_id | TenantId"},
  68. {Name: "response", Type: field.TypeString, Size: 2147483647, Comment: "response | 阿里云avatar响应"},
  69. {Name: "token", Type: field.TypeString, Comment: "token | Token", Default: ""},
  70. {Name: "session_id", Type: field.TypeString, Comment: "session_id | SessionId", Default: ""},
  71. }
  72. // AliyunAvatarTable holds the schema information for the "aliyun_avatar" table.
  73. AliyunAvatarTable = &schema.Table{
  74. Name: "aliyun_avatar",
  75. Columns: AliyunAvatarColumns,
  76. PrimaryKey: []*schema.Column{AliyunAvatarColumns[0]},
  77. Indexes: []*schema.Index{
  78. {
  79. Name: "aliyunavatar_user_id",
  80. Unique: false,
  81. Columns: []*schema.Column{AliyunAvatarColumns[4]},
  82. },
  83. },
  84. }
  85. // BatchMsgColumns holds the columns for the "batch_msg" table.
  86. BatchMsgColumns = []*schema.Column{
  87. {Name: "id", Type: field.TypeUint64, Increment: true},
  88. {Name: "created_at", Type: field.TypeTime, Comment: "Create Time | 创建日期"},
  89. {Name: "updated_at", Type: field.TypeTime, Comment: "Update Time | 修改日期"},
  90. {Name: "deleted_at", Type: field.TypeTime, Nullable: true, Comment: "Delete Time | 删除日期"},
  91. {Name: "status", Type: field.TypeUint8, Nullable: true, Comment: "状态 0 未开始 1 开始发送 2 发送完成 3 发送中止"},
  92. {Name: "batch_no", Type: field.TypeString, Unique: true, Nullable: true, Comment: "批次号"},
  93. {Name: "task_name", Type: field.TypeString, Nullable: true, Comment: "任务名称", Default: ""},
  94. {Name: "fromwxid", Type: field.TypeString, Nullable: true, Comment: "发送方微信ID"},
  95. {Name: "msg", Type: field.TypeString, Nullable: true, Comment: "内容"},
  96. {Name: "tag", Type: field.TypeString, Nullable: true, Comment: "发送规则 all 全部 tag1,tag2 按tag发送"},
  97. {Name: "tagids", Type: field.TypeString, Nullable: true, Comment: "要发送的tagids"},
  98. {Name: "total", Type: field.TypeInt32, Nullable: true, Comment: "总数"},
  99. {Name: "success", Type: field.TypeInt32, Nullable: true, Comment: "成功数量"},
  100. {Name: "fail", Type: field.TypeInt32, Nullable: true, Comment: "失败数量"},
  101. {Name: "start_time", Type: field.TypeTime, Nullable: true, Comment: "开始时间"},
  102. {Name: "stop_time", Type: field.TypeTime, Nullable: true, Comment: "结束时间"},
  103. {Name: "send_time", Type: field.TypeTime, Nullable: true, Comment: "发送时间"},
  104. {Name: "type", Type: field.TypeInt32, Nullable: true, Comment: "发送类型 1-群发消息 2-群发朋友圈"},
  105. {Name: "organization_id", Type: field.TypeUint64, Comment: "organization_id | 租户ID"},
  106. }
  107. // BatchMsgTable holds the schema information for the "batch_msg" table.
  108. BatchMsgTable = &schema.Table{
  109. Name: "batch_msg",
  110. Columns: BatchMsgColumns,
  111. PrimaryKey: []*schema.Column{BatchMsgColumns[0]},
  112. Indexes: []*schema.Index{
  113. {
  114. Name: "batchmsg_batch_no",
  115. Unique: true,
  116. Columns: []*schema.Column{BatchMsgColumns[5]},
  117. },
  118. {
  119. Name: "batchmsg_type",
  120. Unique: false,
  121. Columns: []*schema.Column{BatchMsgColumns[17]},
  122. },
  123. },
  124. }
  125. // CategoryColumns holds the columns for the "category" table.
  126. CategoryColumns = []*schema.Column{
  127. {Name: "id", Type: field.TypeUint64, Increment: true},
  128. {Name: "created_at", Type: field.TypeTime, Comment: "Create Time | 创建日期"},
  129. {Name: "updated_at", Type: field.TypeTime, Comment: "Update Time | 修改日期"},
  130. {Name: "deleted_at", Type: field.TypeTime, Nullable: true, Comment: "Delete Time | 删除日期"},
  131. {Name: "name", Type: field.TypeString, Size: 255, Comment: "name | 角色名称"},
  132. {Name: "organization_id", Type: field.TypeUint64, Comment: "organization_id | 租户ID"},
  133. }
  134. // CategoryTable holds the schema information for the "category" table.
  135. CategoryTable = &schema.Table{
  136. Name: "category",
  137. Columns: CategoryColumns,
  138. PrimaryKey: []*schema.Column{CategoryColumns[0]},
  139. Indexes: []*schema.Index{
  140. {
  141. Name: "category_organization_id",
  142. Unique: false,
  143. Columns: []*schema.Column{CategoryColumns[5]},
  144. },
  145. },
  146. }
  147. // ChatRecordsColumns holds the columns for the "chat_records" table.
  148. ChatRecordsColumns = []*schema.Column{
  149. {Name: "id", Type: field.TypeUint64, Increment: true},
  150. {Name: "created_at", Type: field.TypeTime, Comment: "Create Time | 创建日期"},
  151. {Name: "updated_at", Type: field.TypeTime, Comment: "Update Time | 修改日期"},
  152. {Name: "deleted_at", Type: field.TypeTime, Nullable: true, Comment: "Delete Time | 删除日期"},
  153. {Name: "content", Type: field.TypeString, Comment: "内容", Default: ""},
  154. {Name: "content_type", Type: field.TypeUint8, Comment: "内容类型:1-提问 2-回答", Default: 1},
  155. {Name: "session_id", Type: field.TypeUint64, Comment: "会话ID", Default: 0},
  156. {Name: "user_id", Type: field.TypeUint64, Comment: "用户ID", Default: 0},
  157. {Name: "bot_id", Type: field.TypeUint64, Comment: "聊天ID", Default: 0},
  158. {Name: "bot_type", Type: field.TypeUint8, Comment: "类型:1-微信 2-小程序card 3-智能体", Default: 2},
  159. }
  160. // ChatRecordsTable holds the schema information for the "chat_records" table.
  161. ChatRecordsTable = &schema.Table{
  162. Name: "chat_records",
  163. Columns: ChatRecordsColumns,
  164. PrimaryKey: []*schema.Column{ChatRecordsColumns[0]},
  165. Indexes: []*schema.Index{
  166. {
  167. Name: "chatrecords_user_id_bot_id_bot_type",
  168. Unique: false,
  169. Columns: []*schema.Column{ChatRecordsColumns[7], ChatRecordsColumns[8], ChatRecordsColumns[9]},
  170. },
  171. {
  172. Name: "chatrecords_session_id",
  173. Unique: false,
  174. Columns: []*schema.Column{ChatRecordsColumns[6]},
  175. },
  176. },
  177. }
  178. // ChatSessionColumns holds the columns for the "chat_session" table.
  179. ChatSessionColumns = []*schema.Column{
  180. {Name: "id", Type: field.TypeUint64, Increment: true},
  181. {Name: "created_at", Type: field.TypeTime, Comment: "Create Time | 创建日期"},
  182. {Name: "updated_at", Type: field.TypeTime, Comment: "Update Time | 修改日期"},
  183. {Name: "deleted_at", Type: field.TypeTime, Nullable: true, Comment: "Delete Time | 删除日期"},
  184. {Name: "name", Type: field.TypeString, Comment: "名称", Default: ""},
  185. {Name: "user_id", Type: field.TypeUint64, Comment: "用户ID", Default: 0},
  186. {Name: "bot_id", Type: field.TypeUint64, Comment: "聊天ID", Default: 0},
  187. {Name: "bot_type", Type: field.TypeUint8, Comment: "类型:1-微信 2-小程序card 3-智能体", Default: 2},
  188. }
  189. // ChatSessionTable holds the schema information for the "chat_session" table.
  190. ChatSessionTable = &schema.Table{
  191. Name: "chat_session",
  192. Columns: ChatSessionColumns,
  193. PrimaryKey: []*schema.Column{ChatSessionColumns[0]},
  194. Indexes: []*schema.Index{
  195. {
  196. Name: "chatsession_user_id_bot_id_bot_type",
  197. Unique: false,
  198. Columns: []*schema.Column{ChatSessionColumns[5], ChatSessionColumns[6], ChatSessionColumns[7]},
  199. },
  200. },
  201. }
  202. // ContactColumns holds the columns for the "contact" table.
  203. ContactColumns = []*schema.Column{
  204. {Name: "id", Type: field.TypeUint64, Increment: true},
  205. {Name: "created_at", Type: field.TypeTime, Comment: "Create Time | 创建日期"},
  206. {Name: "updated_at", Type: field.TypeTime, Comment: "Update Time | 修改日期"},
  207. {Name: "status", Type: field.TypeUint8, Nullable: true, Comment: "Status 1: normal 2: ban | 状态 1 正常 2 禁用", Default: 1},
  208. {Name: "deleted_at", Type: field.TypeTime, Nullable: true, Comment: "Delete Time | 删除日期"},
  209. {Name: "wx_wxid", Type: field.TypeString, Comment: "属主微信id", Default: ""},
  210. {Name: "type", Type: field.TypeInt, Nullable: true, Comment: "联系人类型:1好友,2群组,3公众号,4企业微信联系人", Default: 1},
  211. {Name: "wxid", Type: field.TypeString, Comment: "微信id 公众号微信ID", Default: ""},
  212. {Name: "account", Type: field.TypeString, Comment: "微信账号", Default: ""},
  213. {Name: "nickname", Type: field.TypeString, Comment: "微信昵称 群备注名称", Default: ""},
  214. {Name: "markname", Type: field.TypeString, Comment: "备注名", Default: ""},
  215. {Name: "headimg", Type: field.TypeString, Comment: "头像", Default: ""},
  216. {Name: "sex", Type: field.TypeInt, Comment: "性别 0未知 1男 2女", Default: 0},
  217. {Name: "starrole", Type: field.TypeString, Comment: "星标 65/67=星标 1/3=未星标", Default: ""},
  218. {Name: "dontseeit", Type: field.TypeInt, Comment: "不让他看我的朋友圈 0可以看 1不让看", Default: 0},
  219. {Name: "dontseeme", Type: field.TypeInt, Comment: "不看他的朋友圈 0可以看 1不看 1=开启了不看他 128/129=仅聊天", Default: 0},
  220. {Name: "lag", Type: field.TypeString, Comment: "所属标签id清单,多开会用逗号隔开", Default: ""},
  221. {Name: "gid", Type: field.TypeString, Comment: "群组id", Default: ""},
  222. {Name: "gname", Type: field.TypeString, Comment: "群组名称", Default: ""},
  223. {Name: "v3", Type: field.TypeString, Comment: "v3数据", Default: ""},
  224. {Name: "organization_id", Type: field.TypeUint64, Nullable: true, Comment: "机构 ID", Default: 1},
  225. }
  226. // ContactTable holds the schema information for the "contact" table.
  227. ContactTable = &schema.Table{
  228. Name: "contact",
  229. Columns: ContactColumns,
  230. PrimaryKey: []*schema.Column{ContactColumns[0]},
  231. Indexes: []*schema.Index{
  232. {
  233. Name: "contact_wx_wxid_wxid",
  234. Unique: true,
  235. Columns: []*schema.Column{ContactColumns[5], ContactColumns[7]},
  236. },
  237. {
  238. Name: "contact_wxid",
  239. Unique: false,
  240. Columns: []*schema.Column{ContactColumns[7]},
  241. },
  242. {
  243. Name: "contact_type",
  244. Unique: false,
  245. Columns: []*schema.Column{ContactColumns[6]},
  246. },
  247. {
  248. Name: "contact_gid",
  249. Unique: false,
  250. Columns: []*schema.Column{ContactColumns[17]},
  251. },
  252. },
  253. }
  254. // EmployeeColumns holds the columns for the "employee" table.
  255. EmployeeColumns = []*schema.Column{
  256. {Name: "id", Type: field.TypeUint64, Increment: true},
  257. {Name: "created_at", Type: field.TypeTime, Comment: "Create Time | 创建日期"},
  258. {Name: "updated_at", Type: field.TypeTime, Comment: "Update Time | 修改日期"},
  259. {Name: "deleted_at", Type: field.TypeTime, Nullable: true, Comment: "Delete Time | 删除日期"},
  260. {Name: "title", Type: field.TypeString, Size: 255, Comment: "title | 标题"},
  261. {Name: "avatar", Type: field.TypeString, Size: 1000, Comment: "avatar | 头像"},
  262. {Name: "tags", Type: field.TypeString, Size: 255, Comment: "tags | 个人标签"},
  263. {Name: "hire_count", Type: field.TypeInt, Comment: "hire_count | 被雇佣次数", Default: 0},
  264. {Name: "service_count", Type: field.TypeInt, Comment: "service_count | 已服务次数", Default: 0},
  265. {Name: "achievement_count", Type: field.TypeInt, Comment: "achievement_count | 业绩单数", Default: 0},
  266. {Name: "intro", Type: field.TypeString, Size: 1000, Comment: "intro | 个人介绍", Default: ""},
  267. {Name: "estimate", Type: field.TypeString, Size: 1000, Comment: "estimate | 自我评价", Default: ""},
  268. {Name: "skill", Type: field.TypeString, Size: 1000, Comment: "skill | 技能卡", Default: ""},
  269. {Name: "ability_type", Type: field.TypeString, Comment: "ability_type | 能力类型", Default: ""},
  270. {Name: "scene", Type: field.TypeString, Comment: "scene | 使用场景", Default: ""},
  271. {Name: "switch_in", Type: field.TypeString, Comment: "switch_in | 支持介入", Default: ""},
  272. {Name: "video_url", Type: field.TypeString, Size: 1000, Comment: "video_url | 视频地址", Default: ""},
  273. {Name: "organization_id", Type: field.TypeUint64, Comment: "organization_id | 租户ID"},
  274. {Name: "category_id", Type: field.TypeUint64, Comment: "category_id | 分类ID"},
  275. {Name: "api_base", Type: field.TypeString, Comment: "api_base", Default: ""},
  276. {Name: "api_key", Type: field.TypeString, Comment: "api_key", Default: ""},
  277. {Name: "ai_info", Type: field.TypeString, Nullable: true, Comment: "AI信息"},
  278. {Name: "is_vip", Type: field.TypeInt, Comment: "是否VIP:0-否 1-是", Default: 0},
  279. {Name: "chat_url", Type: field.TypeString, Comment: "聊天URL"},
  280. }
  281. // EmployeeTable holds the schema information for the "employee" table.
  282. EmployeeTable = &schema.Table{
  283. Name: "employee",
  284. Columns: EmployeeColumns,
  285. PrimaryKey: []*schema.Column{EmployeeColumns[0]},
  286. Indexes: []*schema.Index{
  287. {
  288. Name: "employee_organization_id",
  289. Unique: false,
  290. Columns: []*schema.Column{EmployeeColumns[17]},
  291. },
  292. },
  293. }
  294. // EmployeeConfigColumns holds the columns for the "employee_config" table.
  295. EmployeeConfigColumns = []*schema.Column{
  296. {Name: "id", Type: field.TypeUint64, Increment: true},
  297. {Name: "created_at", Type: field.TypeTime, Comment: "Create Time | 创建日期"},
  298. {Name: "updated_at", Type: field.TypeTime, Comment: "Update Time | 修改日期"},
  299. {Name: "deleted_at", Type: field.TypeTime, Nullable: true, Comment: "Delete Time | 删除日期"},
  300. {Name: "stype", Type: field.TypeString, Comment: "类型:scene-场景 switch_in-接入方式", Default: ""},
  301. {Name: "title", Type: field.TypeString, Comment: "标题", Default: ""},
  302. {Name: "photo", Type: field.TypeString, Comment: "图片地址", Default: ""},
  303. {Name: "organization_id", Type: field.TypeUint64, Nullable: true, Comment: "机构 ID", Default: 1},
  304. }
  305. // EmployeeConfigTable holds the schema information for the "employee_config" table.
  306. EmployeeConfigTable = &schema.Table{
  307. Name: "employee_config",
  308. Columns: EmployeeConfigColumns,
  309. PrimaryKey: []*schema.Column{EmployeeConfigColumns[0]},
  310. Indexes: []*schema.Index{
  311. {
  312. Name: "employeeconfig_stype",
  313. Unique: false,
  314. Columns: []*schema.Column{EmployeeConfigColumns[4]},
  315. },
  316. },
  317. }
  318. // LabelColumns holds the columns for the "label" table.
  319. LabelColumns = []*schema.Column{
  320. {Name: "id", Type: field.TypeUint64, Increment: true},
  321. {Name: "created_at", Type: field.TypeTime, Comment: "Create Time | 创建日期"},
  322. {Name: "updated_at", Type: field.TypeTime, Comment: "Update Time | 修改日期"},
  323. {Name: "status", Type: field.TypeUint8, Nullable: true, Comment: "Status 1: normal 2: ban | 状态 1 正常 2 禁用", Default: 1},
  324. {Name: "type", Type: field.TypeInt, Comment: "标签类型:1好友,2群组,3公众号,4企业微信联系人", Default: 1},
  325. {Name: "name", Type: field.TypeString, Comment: "标签名称", Default: ""},
  326. {Name: "from", Type: field.TypeInt, Comment: "标签来源:1后台创建 2个微同步", Default: 1},
  327. {Name: "mode", Type: field.TypeInt, Comment: "标签模式:1动态 2静态", Default: 1},
  328. {Name: "conditions", Type: field.TypeString, Nullable: true, Comment: "标签的触达条件", Default: ""},
  329. {Name: "organization_id", Type: field.TypeUint64, Nullable: true, Comment: "机构 ID", Default: 1},
  330. }
  331. // LabelTable holds the schema information for the "label" table.
  332. LabelTable = &schema.Table{
  333. Name: "label",
  334. Columns: LabelColumns,
  335. PrimaryKey: []*schema.Column{LabelColumns[0]},
  336. Indexes: []*schema.Index{
  337. {
  338. Name: "label_name_from_mode",
  339. Unique: true,
  340. Columns: []*schema.Column{LabelColumns[5], LabelColumns[6], LabelColumns[7]},
  341. },
  342. },
  343. }
  344. // LabelRelationshipColumns holds the columns for the "label_relationship" table.
  345. LabelRelationshipColumns = []*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: "status", Type: field.TypeUint8, Nullable: true, Comment: "Status 1: normal 2: ban | 状态 1 正常 2 禁用", Default: 1},
  350. {Name: "deleted_at", Type: field.TypeTime, Nullable: true, Comment: "Delete Time | 删除日期"},
  351. {Name: "organization_id", Type: field.TypeUint64, Nullable: true, Comment: "机构 ID", Default: 1},
  352. {Name: "contact_id", Type: field.TypeUint64, Comment: "联系人 ID", Default: 1},
  353. {Name: "label_id", Type: field.TypeUint64, Comment: "标签 ID", Default: 1},
  354. }
  355. // LabelRelationshipTable holds the schema information for the "label_relationship" table.
  356. LabelRelationshipTable = &schema.Table{
  357. Name: "label_relationship",
  358. Columns: LabelRelationshipColumns,
  359. PrimaryKey: []*schema.Column{LabelRelationshipColumns[0]},
  360. ForeignKeys: []*schema.ForeignKey{
  361. {
  362. Symbol: "label_relationship_contact_contact_relationships",
  363. Columns: []*schema.Column{LabelRelationshipColumns[6]},
  364. RefColumns: []*schema.Column{ContactColumns[0]},
  365. OnDelete: schema.NoAction,
  366. },
  367. {
  368. Symbol: "label_relationship_label_label_relationships",
  369. Columns: []*schema.Column{LabelRelationshipColumns[7]},
  370. RefColumns: []*schema.Column{LabelColumns[0]},
  371. OnDelete: schema.NoAction,
  372. },
  373. },
  374. Indexes: []*schema.Index{
  375. {
  376. Name: "labelrelationship_label_id",
  377. Unique: false,
  378. Columns: []*schema.Column{LabelRelationshipColumns[7]},
  379. },
  380. {
  381. Name: "labelrelationship_contact_id",
  382. Unique: false,
  383. Columns: []*schema.Column{LabelRelationshipColumns[6]},
  384. },
  385. },
  386. }
  387. // MessagesColumns holds the columns for the "messages" table.
  388. MessagesColumns = []*schema.Column{
  389. {Name: "id", Type: field.TypeInt, Increment: true},
  390. {Name: "wx_wxid", Type: field.TypeString, Nullable: true, Comment: "属主微信id", Default: ""},
  391. {Name: "wxid", Type: field.TypeString, Comment: "微信id 公众号微信ID", Default: ""},
  392. {Name: "content", Type: field.TypeString, Comment: "微信消息内容", Default: ""},
  393. }
  394. // MessagesTable holds the schema information for the "messages" table.
  395. MessagesTable = &schema.Table{
  396. Name: "messages",
  397. Columns: MessagesColumns,
  398. PrimaryKey: []*schema.Column{MessagesColumns[0]},
  399. }
  400. // MessageRecordsColumns holds the columns for the "message_records" table.
  401. MessageRecordsColumns = []*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: "bot_wxid", Type: field.TypeString, Comment: "机器人微信 id"},
  407. {Name: "contact_type", Type: field.TypeInt, Comment: "类型:1好友,2群组,3企业微信联系人", Default: 1},
  408. {Name: "contact_wxid", Type: field.TypeString, Comment: "接收方微信 id", Default: ""},
  409. {Name: "content_type", Type: field.TypeInt, Comment: "内容类型 1 文本 2 文件", Default: 1},
  410. {Name: "content", Type: field.TypeString, Comment: "发送内容", Default: ""},
  411. {Name: "meta", Type: field.TypeJSON, Nullable: true, Comment: "元数据"},
  412. {Name: "error_detail", Type: field.TypeString, Comment: "异常原因", Default: ""},
  413. {Name: "send_time", Type: field.TypeTime, Nullable: true, Comment: "发送时间"},
  414. {Name: "source_type", Type: field.TypeInt, Comment: "源类型 1 点发 2 群发 3 SOP", Default: 1},
  415. {Name: "organization_id", Type: field.TypeUint64, Nullable: true, Comment: "机构 ID", Default: 1},
  416. {Name: "contact_id", Type: field.TypeUint64, Nullable: true, Comment: "联系人 id"},
  417. {Name: "sub_source_id", Type: field.TypeUint64, Nullable: true, Comment: "次源 ID", Default: 1},
  418. {Name: "source_id", Type: field.TypeUint64, Nullable: true, Comment: "源 ID", Default: 1},
  419. }
  420. // MessageRecordsTable holds the schema information for the "message_records" table.
  421. MessageRecordsTable = &schema.Table{
  422. Name: "message_records",
  423. Columns: MessageRecordsColumns,
  424. PrimaryKey: []*schema.Column{MessageRecordsColumns[0]},
  425. ForeignKeys: []*schema.ForeignKey{
  426. {
  427. Symbol: "message_records_contact_contact_messages",
  428. Columns: []*schema.Column{MessageRecordsColumns[14]},
  429. RefColumns: []*schema.Column{ContactColumns[0]},
  430. OnDelete: schema.SetNull,
  431. },
  432. {
  433. Symbol: "message_records_sop_node_node_messages",
  434. Columns: []*schema.Column{MessageRecordsColumns[15]},
  435. RefColumns: []*schema.Column{SopNodeColumns[0]},
  436. OnDelete: schema.SetNull,
  437. },
  438. {
  439. Symbol: "message_records_sop_stage_stage_messages",
  440. Columns: []*schema.Column{MessageRecordsColumns[16]},
  441. RefColumns: []*schema.Column{SopStageColumns[0]},
  442. OnDelete: schema.SetNull,
  443. },
  444. },
  445. Indexes: []*schema.Index{
  446. {
  447. Name: "messagerecords_source_type",
  448. Unique: false,
  449. Columns: []*schema.Column{MessageRecordsColumns[12]},
  450. },
  451. },
  452. }
  453. // MsgColumns holds the columns for the "msg" table.
  454. MsgColumns = []*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: "deleted_at", Type: field.TypeTime, Nullable: true, Comment: "Delete Time | 删除日期"},
  459. {Name: "status", Type: field.TypeUint8, Nullable: true, Comment: "Status 1: normal 2: ban | 状态 1 正常 2 禁用"},
  460. {Name: "fromwxid", Type: field.TypeString, Nullable: true, Comment: "发送方微信ID"},
  461. {Name: "toid", Type: field.TypeString, Nullable: true, Comment: "接收人微信ID/群ID"},
  462. {Name: "msgtype", Type: field.TypeInt32, Nullable: true, Comment: "消息类型"},
  463. {Name: "msg", Type: field.TypeString, Nullable: true, Comment: "消息"},
  464. {Name: "batch_no", Type: field.TypeString, Nullable: true, Comment: "批次号"},
  465. }
  466. // MsgTable holds the schema information for the "msg" table.
  467. MsgTable = &schema.Table{
  468. Name: "msg",
  469. Columns: MsgColumns,
  470. PrimaryKey: []*schema.Column{MsgColumns[0]},
  471. Indexes: []*schema.Index{
  472. {
  473. Name: "msg_batch_no",
  474. Unique: false,
  475. Columns: []*schema.Column{MsgColumns[9]},
  476. },
  477. {
  478. Name: "msg_id",
  479. Unique: false,
  480. Columns: []*schema.Column{MsgColumns[0]},
  481. },
  482. {
  483. Name: "msg_status",
  484. Unique: false,
  485. Columns: []*schema.Column{MsgColumns[4]},
  486. },
  487. },
  488. }
  489. // ServerColumns holds the columns for the "server" table.
  490. ServerColumns = []*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: "名称"},
  497. {Name: "public_ip", Type: field.TypeString, Comment: "公网ip"},
  498. {Name: "private_ip", Type: field.TypeString, Comment: "内网ip"},
  499. {Name: "admin_port", Type: field.TypeString, Comment: "管理端口"},
  500. }
  501. // ServerTable holds the schema information for the "server" table.
  502. ServerTable = &schema.Table{
  503. Name: "server",
  504. Columns: ServerColumns,
  505. PrimaryKey: []*schema.Column{ServerColumns[0]},
  506. Indexes: []*schema.Index{
  507. {
  508. Name: "server_name",
  509. Unique: false,
  510. Columns: []*schema.Column{ServerColumns[5]},
  511. },
  512. {
  513. Name: "server_private_ip",
  514. Unique: false,
  515. Columns: []*schema.Column{ServerColumns[7]},
  516. },
  517. {
  518. Name: "server_public_ip",
  519. Unique: true,
  520. Columns: []*schema.Column{ServerColumns[6]},
  521. },
  522. },
  523. }
  524. // SopNodeColumns holds the columns for the "sop_node" table.
  525. SopNodeColumns = []*schema.Column{
  526. {Name: "id", Type: field.TypeUint64, Increment: true},
  527. {Name: "created_at", Type: field.TypeTime, Comment: "Create Time | 创建日期"},
  528. {Name: "updated_at", Type: field.TypeTime, Comment: "Update Time | 修改日期"},
  529. {Name: "status", Type: field.TypeUint8, Nullable: true, Comment: "Status 1: normal 2: ban | 状态 1 正常 2 禁用", Default: 1},
  530. {Name: "deleted_at", Type: field.TypeTime, Nullable: true, Comment: "Delete Time | 删除日期"},
  531. {Name: "parent_id", Type: field.TypeUint64, Comment: "父节点 ID"},
  532. {Name: "name", Type: field.TypeString, Comment: "节点名称", Default: ""},
  533. {Name: "condition_type", Type: field.TypeInt, Comment: "触发条件类型 1 客户回复后触发 2 超时后触发", Default: 1},
  534. {Name: "condition_list", Type: field.TypeJSON, Nullable: true, Comment: "触发语义列表 当为空时则代表用户回复任意内容后触发"},
  535. {Name: "no_reply_condition", Type: field.TypeUint64, Comment: "超时触发时间(分钟)", Default: 0},
  536. {Name: "no_reply_unit", Type: field.TypeString, Comment: "超时触发时间单位", Default: ""},
  537. {Name: "action_message", Type: field.TypeJSON, Nullable: true, Comment: "命中后发送的消息内容"},
  538. {Name: "action_label_add", Type: field.TypeJSON, Nullable: true, Comment: "命中后需要打的标签"},
  539. {Name: "action_label_del", Type: field.TypeJSON, Nullable: true, Comment: "命中后需要移除的标签"},
  540. {Name: "action_forward", Type: field.TypeJSON, Nullable: true, Comment: "命中后转发的消息"},
  541. {Name: "stage_id", Type: field.TypeUint64, Comment: "阶段 ID"},
  542. }
  543. // SopNodeTable holds the schema information for the "sop_node" table.
  544. SopNodeTable = &schema.Table{
  545. Name: "sop_node",
  546. Columns: SopNodeColumns,
  547. PrimaryKey: []*schema.Column{SopNodeColumns[0]},
  548. ForeignKeys: []*schema.ForeignKey{
  549. {
  550. Symbol: "sop_node_sop_stage_stage_nodes",
  551. Columns: []*schema.Column{SopNodeColumns[15]},
  552. RefColumns: []*schema.Column{SopStageColumns[0]},
  553. OnDelete: schema.NoAction,
  554. },
  555. },
  556. Indexes: []*schema.Index{
  557. {
  558. Name: "sopnode_name",
  559. Unique: false,
  560. Columns: []*schema.Column{SopNodeColumns[6]},
  561. },
  562. },
  563. }
  564. // SopStageColumns holds the columns for the "sop_stage" table.
  565. SopStageColumns = []*schema.Column{
  566. {Name: "id", Type: field.TypeUint64, Increment: true},
  567. {Name: "created_at", Type: field.TypeTime, Comment: "Create Time | 创建日期"},
  568. {Name: "updated_at", Type: field.TypeTime, Comment: "Update Time | 修改日期"},
  569. {Name: "status", Type: field.TypeUint8, Nullable: true, Comment: "Status 1: normal 2: ban | 状态 1 正常 2 禁用", Default: 1},
  570. {Name: "deleted_at", Type: field.TypeTime, Nullable: true, Comment: "Delete Time | 删除日期"},
  571. {Name: "name", Type: field.TypeString, Comment: "阶段名称", Default: ""},
  572. {Name: "condition_type", Type: field.TypeInt, Comment: "客群筛选条件类型 1 按标签筛选 2 按客户基本信息筛选", Default: 1},
  573. {Name: "condition_operator", Type: field.TypeInt, Comment: "筛选条件关系 1 满足所有条件(and) 2 满足任意条件(or)", Default: 1},
  574. {Name: "condition_list", Type: field.TypeJSON, Comment: "筛选条件列表"},
  575. {Name: "action_message", Type: field.TypeJSON, Nullable: true, Comment: "命中后发送的消息内容"},
  576. {Name: "action_label_add", Type: field.TypeJSON, Nullable: true, Comment: "命中后需要打的标签"},
  577. {Name: "action_label_del", Type: field.TypeJSON, Nullable: true, Comment: "命中后需要移除的标签"},
  578. {Name: "action_forward", Type: field.TypeJSON, Nullable: true, Comment: "命中后转发的消息"},
  579. {Name: "index_sort", Type: field.TypeInt, Nullable: true, Comment: "阶段顺序", Default: 1},
  580. {Name: "task_id", Type: field.TypeUint64, Comment: "SOP 任务 ID"},
  581. }
  582. // SopStageTable holds the schema information for the "sop_stage" table.
  583. SopStageTable = &schema.Table{
  584. Name: "sop_stage",
  585. Columns: SopStageColumns,
  586. PrimaryKey: []*schema.Column{SopStageColumns[0]},
  587. ForeignKeys: []*schema.ForeignKey{
  588. {
  589. Symbol: "sop_stage_sop_task_task_stages",
  590. Columns: []*schema.Column{SopStageColumns[14]},
  591. RefColumns: []*schema.Column{SopTaskColumns[0]},
  592. OnDelete: schema.NoAction,
  593. },
  594. },
  595. Indexes: []*schema.Index{
  596. {
  597. Name: "sopstage_name",
  598. Unique: false,
  599. Columns: []*schema.Column{SopStageColumns[5]},
  600. },
  601. },
  602. }
  603. // SopTaskColumns holds the columns for the "sop_task" table.
  604. SopTaskColumns = []*schema.Column{
  605. {Name: "id", Type: field.TypeUint64, Increment: true},
  606. {Name: "created_at", Type: field.TypeTime, Comment: "Create Time | 创建日期"},
  607. {Name: "updated_at", Type: field.TypeTime, Comment: "Update Time | 修改日期"},
  608. {Name: "status", Type: field.TypeUint8, Nullable: true, Comment: "Status 1: normal 2: ban | 状态 1 正常 2 禁用", Default: 1},
  609. {Name: "deleted_at", Type: field.TypeTime, Nullable: true, Comment: "Delete Time | 删除日期"},
  610. {Name: "name", Type: field.TypeString, Comment: "SOP 任务名称"},
  611. {Name: "bot_wxid_list", Type: field.TypeJSON, Nullable: true, Comment: "机器人微信 id 列表"},
  612. {Name: "type", Type: field.TypeInt, Comment: "标签类型:1好友,2群组,3企业微信联系人", Default: 1},
  613. {Name: "plan_start_time", Type: field.TypeTime, Nullable: true, Comment: "任务计划开始时间"},
  614. {Name: "plan_end_time", Type: field.TypeTime, Nullable: true, Comment: "任务计划结束时间"},
  615. {Name: "creator_id", Type: field.TypeString, Nullable: true, Comment: "创建者 id"},
  616. {Name: "organization_id", Type: field.TypeUint64, Nullable: true, Comment: "机构 ID", Default: 1},
  617. {Name: "token", Type: field.TypeJSON, Nullable: true, Comment: "Token"},
  618. }
  619. // SopTaskTable holds the schema information for the "sop_task" table.
  620. SopTaskTable = &schema.Table{
  621. Name: "sop_task",
  622. Columns: SopTaskColumns,
  623. PrimaryKey: []*schema.Column{SopTaskColumns[0]},
  624. Indexes: []*schema.Index{
  625. {
  626. Name: "soptask_name",
  627. Unique: false,
  628. Columns: []*schema.Column{SopTaskColumns[5]},
  629. },
  630. {
  631. Name: "soptask_token",
  632. Unique: false,
  633. Columns: []*schema.Column{SopTaskColumns[12]},
  634. },
  635. },
  636. }
  637. // TokenColumns holds the columns for the "token" table.
  638. TokenColumns = []*schema.Column{
  639. {Name: "id", Type: field.TypeUint64, Increment: true},
  640. {Name: "created_at", Type: field.TypeTime, Comment: "Create Time | 创建日期"},
  641. {Name: "updated_at", Type: field.TypeTime, Comment: "Update Time | 修改日期"},
  642. {Name: "deleted_at", Type: field.TypeTime, Nullable: true, Comment: "Delete Time | 删除日期"},
  643. {Name: "expire_at", Type: field.TypeTime, Nullable: true, Comment: "过期时间"},
  644. {Name: "token", Type: field.TypeString, Nullable: true, Comment: "Token", Default: ""},
  645. {Name: "mac", Type: field.TypeString, Nullable: true, Comment: "Mac地址", Default: ""},
  646. {Name: "organization_id", Type: field.TypeUint64, Comment: "租户ID", Default: 0},
  647. {Name: "custom_agent_base", Type: field.TypeString, Nullable: true, Comment: "定制agent服务地址", Default: ""},
  648. {Name: "custom_agent_key", Type: field.TypeString, Nullable: true, Comment: "定制agent服务密钥", Default: ""},
  649. {Name: "openai_base", Type: field.TypeString, Nullable: true, Comment: "大模型服务地址", Default: ""},
  650. {Name: "openai_key", Type: field.TypeString, Nullable: true, Comment: "大模型服务密钥", Default: ""},
  651. {Name: "agent_id", Type: field.TypeUint64, Comment: "智能体ID", Default: 0},
  652. }
  653. // TokenTable holds the schema information for the "token" table.
  654. TokenTable = &schema.Table{
  655. Name: "token",
  656. Columns: TokenColumns,
  657. PrimaryKey: []*schema.Column{TokenColumns[0]},
  658. ForeignKeys: []*schema.ForeignKey{
  659. {
  660. Symbol: "token_agent_token_agent",
  661. Columns: []*schema.Column{TokenColumns[12]},
  662. RefColumns: []*schema.Column{AgentColumns[0]},
  663. OnDelete: schema.NoAction,
  664. },
  665. },
  666. Indexes: []*schema.Index{
  667. {
  668. Name: "token_token",
  669. Unique: true,
  670. Columns: []*schema.Column{TokenColumns[5]},
  671. },
  672. },
  673. }
  674. // TutorialColumns holds the columns for the "tutorial" table.
  675. TutorialColumns = []*schema.Column{
  676. {Name: "id", Type: field.TypeUint64, Increment: true},
  677. {Name: "created_at", Type: field.TypeTime, Comment: "Create Time | 创建日期"},
  678. {Name: "updated_at", Type: field.TypeTime, Comment: "Update Time | 修改日期"},
  679. {Name: "deleted_at", Type: field.TypeTime, Nullable: true, Comment: "Delete Time | 删除日期"},
  680. {Name: "index", Type: field.TypeInt, Comment: "index | 序号"},
  681. {Name: "title", Type: field.TypeString, Comment: "title | 标题"},
  682. {Name: "content", Type: field.TypeString, Comment: "content | 内容"},
  683. {Name: "organization_id", Type: field.TypeUint64, Comment: "organization_id | 租户ID"},
  684. {Name: "employee_id", Type: field.TypeUint64, Comment: "employee_id | 员工ID"},
  685. }
  686. // TutorialTable holds the schema information for the "tutorial" table.
  687. TutorialTable = &schema.Table{
  688. Name: "tutorial",
  689. Columns: TutorialColumns,
  690. PrimaryKey: []*schema.Column{TutorialColumns[0]},
  691. ForeignKeys: []*schema.ForeignKey{
  692. {
  693. Symbol: "tutorial_employee_em_tutorial",
  694. Columns: []*schema.Column{TutorialColumns[8]},
  695. RefColumns: []*schema.Column{EmployeeColumns[0]},
  696. OnDelete: schema.NoAction,
  697. },
  698. },
  699. Indexes: []*schema.Index{
  700. {
  701. Name: "tutorial_employee_id",
  702. Unique: false,
  703. Columns: []*schema.Column{TutorialColumns[8]},
  704. },
  705. },
  706. }
  707. // WorkExperienceColumns holds the columns for the "work_experience" table.
  708. WorkExperienceColumns = []*schema.Column{
  709. {Name: "id", Type: field.TypeUint64, Increment: true},
  710. {Name: "created_at", Type: field.TypeTime, Comment: "Create Time | 创建日期"},
  711. {Name: "updated_at", Type: field.TypeTime, Comment: "Update Time | 修改日期"},
  712. {Name: "deleted_at", Type: field.TypeTime, Nullable: true, Comment: "Delete Time | 删除日期"},
  713. {Name: "start_date", Type: field.TypeTime, Comment: "start_date | 开始时间"},
  714. {Name: "end_date", Type: field.TypeTime, Comment: "end_date | 结束时间"},
  715. {Name: "company", Type: field.TypeString, Comment: "company | 公司名"},
  716. {Name: "experience", Type: field.TypeString, Size: 2147483647, Comment: "experience | 工作内容"},
  717. {Name: "organization_id", Type: field.TypeUint64, Comment: "organization_id | 租户ID"},
  718. {Name: "employee_id", Type: field.TypeUint64, Comment: "employee_id | 员工ID"},
  719. }
  720. // WorkExperienceTable holds the schema information for the "work_experience" table.
  721. WorkExperienceTable = &schema.Table{
  722. Name: "work_experience",
  723. Columns: WorkExperienceColumns,
  724. PrimaryKey: []*schema.Column{WorkExperienceColumns[0]},
  725. ForeignKeys: []*schema.ForeignKey{
  726. {
  727. Symbol: "work_experience_employee_em_work_experiences",
  728. Columns: []*schema.Column{WorkExperienceColumns[9]},
  729. RefColumns: []*schema.Column{EmployeeColumns[0]},
  730. OnDelete: schema.NoAction,
  731. },
  732. },
  733. Indexes: []*schema.Index{
  734. {
  735. Name: "workexperience_employee_id",
  736. Unique: false,
  737. Columns: []*schema.Column{WorkExperienceColumns[9]},
  738. },
  739. },
  740. }
  741. // WxColumns holds the columns for the "wx" table.
  742. WxColumns = []*schema.Column{
  743. {Name: "id", Type: field.TypeUint64, Increment: true},
  744. {Name: "created_at", Type: field.TypeTime, Comment: "Create Time | 创建日期"},
  745. {Name: "updated_at", Type: field.TypeTime, Comment: "Update Time | 修改日期"},
  746. {Name: "status", Type: field.TypeUint8, Nullable: true, Comment: "Status 1: normal 2: ban | 状态 1 正常 2 禁用", Default: 1},
  747. {Name: "deleted_at", Type: field.TypeTime, Nullable: true, Comment: "Delete Time | 删除日期"},
  748. {Name: "port", Type: field.TypeString, Comment: "端口号", Default: ""},
  749. {Name: "process_id", Type: field.TypeString, Comment: "进程号", Default: ""},
  750. {Name: "callback", Type: field.TypeString, Comment: "回调地址", Default: ""},
  751. {Name: "wxid", Type: field.TypeString, Comment: "微信id", Default: ""},
  752. {Name: "account", Type: field.TypeString, Comment: "微信账号", Default: ""},
  753. {Name: "nickname", Type: field.TypeString, Comment: "微信昵称", Default: ""},
  754. {Name: "tel", Type: field.TypeString, Comment: "手机号", Default: ""},
  755. {Name: "head_big", Type: field.TypeString, Comment: "微信头像", Default: ""},
  756. {Name: "organization_id", Type: field.TypeUint64, Nullable: true, Comment: "机构 ID", Default: 1},
  757. {Name: "api_base", Type: field.TypeString, Nullable: true, Comment: "大模型服务地址", Default: ""},
  758. {Name: "api_key", Type: field.TypeString, Nullable: true, Comment: "大模型服务密钥", Default: ""},
  759. {Name: "allow_list", Type: field.TypeJSON, Comment: "白名单"},
  760. {Name: "group_allow_list", Type: field.TypeJSON, Comment: "群白名单"},
  761. {Name: "block_list", Type: field.TypeJSON, Comment: "黑名单"},
  762. {Name: "group_block_list", Type: field.TypeJSON, Comment: "群黑名单"},
  763. {Name: "agent_id", Type: field.TypeUint64, Comment: "模式ID", Default: 0},
  764. {Name: "agent_base_wx_agent", Type: field.TypeString, Nullable: true},
  765. {Name: "server_id", Type: field.TypeUint64, Nullable: true, Comment: "服务器id", Default: 0},
  766. }
  767. // WxTable holds the schema information for the "wx" table.
  768. WxTable = &schema.Table{
  769. Name: "wx",
  770. Columns: WxColumns,
  771. PrimaryKey: []*schema.Column{WxColumns[0]},
  772. ForeignKeys: []*schema.ForeignKey{
  773. {
  774. Symbol: "wx_agent_wx_agent",
  775. Columns: []*schema.Column{WxColumns[20]},
  776. RefColumns: []*schema.Column{AgentColumns[0]},
  777. OnDelete: schema.NoAction,
  778. },
  779. {
  780. Symbol: "wx_agent_base_wx_agent",
  781. Columns: []*schema.Column{WxColumns[21]},
  782. RefColumns: []*schema.Column{AgentBaseColumns[0]},
  783. OnDelete: schema.SetNull,
  784. },
  785. {
  786. Symbol: "wx_server_wxs",
  787. Columns: []*schema.Column{WxColumns[22]},
  788. RefColumns: []*schema.Column{ServerColumns[0]},
  789. OnDelete: schema.SetNull,
  790. },
  791. },
  792. Indexes: []*schema.Index{
  793. {
  794. Name: "wx_server_id_port",
  795. Unique: true,
  796. Columns: []*schema.Column{WxColumns[22], WxColumns[5]},
  797. },
  798. {
  799. Name: "wx_wxid",
  800. Unique: true,
  801. Columns: []*schema.Column{WxColumns[8]},
  802. },
  803. {
  804. Name: "wx_account",
  805. Unique: false,
  806. Columns: []*schema.Column{WxColumns[9]},
  807. },
  808. {
  809. Name: "wx_nickname",
  810. Unique: false,
  811. Columns: []*schema.Column{WxColumns[10]},
  812. },
  813. {
  814. Name: "wx_tel",
  815. Unique: false,
  816. Columns: []*schema.Column{WxColumns[11]},
  817. },
  818. },
  819. }
  820. // WxCardColumns holds the columns for the "wx_card" table.
  821. WxCardColumns = []*schema.Column{
  822. {Name: "id", Type: field.TypeUint64, Increment: true},
  823. {Name: "created_at", Type: field.TypeTime, Comment: "Create Time | 创建日期"},
  824. {Name: "updated_at", Type: field.TypeTime, Comment: "Update Time | 修改日期"},
  825. {Name: "deleted_at", Type: field.TypeTime, Nullable: true, Comment: "Delete Time | 删除日期"},
  826. {Name: "user_id", Type: field.TypeUint64, Nullable: true, Comment: "user表ID", Default: 0},
  827. {Name: "wx_user_id", Type: field.TypeUint64, Nullable: true, Comment: "wx表ID", Default: 0},
  828. {Name: "avatar", Type: field.TypeString, Comment: "头像", Default: ""},
  829. {Name: "logo", Type: field.TypeString, Comment: "logo", Default: ""},
  830. {Name: "name", Type: field.TypeString, Comment: "名称", Default: ""},
  831. {Name: "company", Type: field.TypeString, Comment: "公司", Default: ""},
  832. {Name: "address", Type: field.TypeString, Comment: "地址", Default: ""},
  833. {Name: "phone", Type: field.TypeString, Comment: "手机号", Default: ""},
  834. {Name: "official_account", Type: field.TypeString, Comment: "公众号", Default: ""},
  835. {Name: "wechat_account", Type: field.TypeString, Comment: "微信号", Default: ""},
  836. {Name: "email", Type: field.TypeString, Nullable: true, Comment: "邮箱", Default: ""},
  837. {Name: "api_base", Type: field.TypeString, Nullable: true, Comment: "fastgpt-base"},
  838. {Name: "api_key", Type: field.TypeString, Nullable: true, Comment: "fastgpt-key"},
  839. {Name: "ai_info", Type: field.TypeString, Nullable: true, Comment: "AI信息"},
  840. {Name: "intro", Type: field.TypeString, Nullable: true, Comment: "个人介绍", Default: ""},
  841. }
  842. // WxCardTable holds the schema information for the "wx_card" table.
  843. WxCardTable = &schema.Table{
  844. Name: "wx_card",
  845. Columns: WxCardColumns,
  846. PrimaryKey: []*schema.Column{WxCardColumns[0]},
  847. Indexes: []*schema.Index{
  848. {
  849. Name: "wxcard_user_id",
  850. Unique: false,
  851. Columns: []*schema.Column{WxCardColumns[4]},
  852. },
  853. {
  854. Name: "wxcard_wx_user_id",
  855. Unique: false,
  856. Columns: []*schema.Column{WxCardColumns[5]},
  857. },
  858. },
  859. }
  860. // WxCardUserColumns holds the columns for the "wx_card_user" table.
  861. WxCardUserColumns = []*schema.Column{
  862. {Name: "id", Type: field.TypeUint64, Increment: true},
  863. {Name: "created_at", Type: field.TypeTime, Comment: "Create Time | 创建日期"},
  864. {Name: "updated_at", Type: field.TypeTime, Comment: "Update Time | 修改日期"},
  865. {Name: "deleted_at", Type: field.TypeTime, Nullable: true, Comment: "Delete Time | 删除日期"},
  866. {Name: "wxid", Type: field.TypeString, Comment: "微信id", Default: ""},
  867. {Name: "account", Type: field.TypeString, Comment: "微信号", Default: ""},
  868. {Name: "avatar", Type: field.TypeString, Comment: "头像", Default: ""},
  869. {Name: "nickname", Type: field.TypeString, Comment: "昵称", Default: ""},
  870. {Name: "remark", Type: field.TypeString, Comment: "备注名", Default: ""},
  871. {Name: "phone", Type: field.TypeString, Comment: "手机号", Default: ""},
  872. {Name: "open_id", Type: field.TypeString, Comment: "OpenID", Default: ""},
  873. {Name: "union_id", Type: field.TypeString, Comment: "UnionID", Default: ""},
  874. {Name: "session_key", Type: field.TypeString, Comment: "SessionKey", Default: ""},
  875. {Name: "is_vip", Type: field.TypeInt, Comment: "是否VIP:0-否 1-是", Default: 0},
  876. }
  877. // WxCardUserTable holds the schema information for the "wx_card_user" table.
  878. WxCardUserTable = &schema.Table{
  879. Name: "wx_card_user",
  880. Columns: WxCardUserColumns,
  881. PrimaryKey: []*schema.Column{WxCardUserColumns[0]},
  882. Indexes: []*schema.Index{
  883. {
  884. Name: "wxcarduser_wxid_open_id",
  885. Unique: false,
  886. Columns: []*schema.Column{WxCardUserColumns[4], WxCardUserColumns[10]},
  887. },
  888. },
  889. }
  890. // WxCardVisitColumns holds the columns for the "wx_card_visit" table.
  891. WxCardVisitColumns = []*schema.Column{
  892. {Name: "id", Type: field.TypeUint64, Increment: true},
  893. {Name: "created_at", Type: field.TypeTime, Comment: "Create Time | 创建日期"},
  894. {Name: "updated_at", Type: field.TypeTime, Comment: "Update Time | 修改日期"},
  895. {Name: "deleted_at", Type: field.TypeTime, Nullable: true, Comment: "Delete Time | 删除日期"},
  896. {Name: "user_id", Type: field.TypeUint64, Nullable: true, Comment: "user表ID", Default: 0},
  897. {Name: "bot_id", Type: field.TypeUint64, Comment: "被访ID", Default: 0},
  898. {Name: "bot_type", Type: field.TypeUint8, Comment: "类型:1-微信 2-小程序 3-智能体", Default: 0},
  899. }
  900. // WxCardVisitTable holds the schema information for the "wx_card_visit" table.
  901. WxCardVisitTable = &schema.Table{
  902. Name: "wx_card_visit",
  903. Columns: WxCardVisitColumns,
  904. PrimaryKey: []*schema.Column{WxCardVisitColumns[0]},
  905. Indexes: []*schema.Index{
  906. {
  907. Name: "wxcardvisit_user_id",
  908. Unique: false,
  909. Columns: []*schema.Column{WxCardVisitColumns[4]},
  910. },
  911. {
  912. Name: "wxcardvisit_bot_id_bot_type",
  913. Unique: false,
  914. Columns: []*schema.Column{WxCardVisitColumns[5], WxCardVisitColumns[6]},
  915. },
  916. },
  917. }
  918. // Tables holds all the tables in the schema.
  919. Tables = []*schema.Table{
  920. AgentTable,
  921. AgentBaseTable,
  922. AliyunAvatarTable,
  923. BatchMsgTable,
  924. CategoryTable,
  925. ChatRecordsTable,
  926. ChatSessionTable,
  927. ContactTable,
  928. EmployeeTable,
  929. EmployeeConfigTable,
  930. LabelTable,
  931. LabelRelationshipTable,
  932. MessagesTable,
  933. MessageRecordsTable,
  934. MsgTable,
  935. ServerTable,
  936. SopNodeTable,
  937. SopStageTable,
  938. SopTaskTable,
  939. TokenTable,
  940. TutorialTable,
  941. WorkExperienceTable,
  942. WxTable,
  943. WxCardTable,
  944. WxCardUserTable,
  945. WxCardVisitTable,
  946. }
  947. )
  948. func init() {
  949. AgentTable.Annotation = &entsql.Annotation{
  950. Table: "agent",
  951. }
  952. AgentBaseTable.Annotation = &entsql.Annotation{
  953. Table: "agent_base",
  954. }
  955. AliyunAvatarTable.Annotation = &entsql.Annotation{
  956. Table: "aliyun_avatar",
  957. }
  958. BatchMsgTable.Annotation = &entsql.Annotation{
  959. Table: "batch_msg",
  960. }
  961. CategoryTable.Annotation = &entsql.Annotation{
  962. Table: "category",
  963. }
  964. ChatRecordsTable.Annotation = &entsql.Annotation{
  965. Table: "chat_records",
  966. }
  967. ChatSessionTable.Annotation = &entsql.Annotation{
  968. Table: "chat_session",
  969. }
  970. ContactTable.Annotation = &entsql.Annotation{
  971. Table: "contact",
  972. }
  973. EmployeeTable.Annotation = &entsql.Annotation{
  974. Table: "employee",
  975. }
  976. EmployeeConfigTable.Annotation = &entsql.Annotation{
  977. Table: "employee_config",
  978. }
  979. LabelTable.Annotation = &entsql.Annotation{
  980. Table: "label",
  981. }
  982. LabelRelationshipTable.ForeignKeys[0].RefTable = ContactTable
  983. LabelRelationshipTable.ForeignKeys[1].RefTable = LabelTable
  984. LabelRelationshipTable.Annotation = &entsql.Annotation{
  985. Table: "label_relationship",
  986. }
  987. MessagesTable.Annotation = &entsql.Annotation{
  988. Table: "messages",
  989. }
  990. MessageRecordsTable.ForeignKeys[0].RefTable = ContactTable
  991. MessageRecordsTable.ForeignKeys[1].RefTable = SopNodeTable
  992. MessageRecordsTable.ForeignKeys[2].RefTable = SopStageTable
  993. MessageRecordsTable.Annotation = &entsql.Annotation{
  994. Table: "message_records",
  995. }
  996. MsgTable.Annotation = &entsql.Annotation{
  997. Table: "msg",
  998. }
  999. ServerTable.Annotation = &entsql.Annotation{
  1000. Table: "server",
  1001. }
  1002. SopNodeTable.ForeignKeys[0].RefTable = SopStageTable
  1003. SopNodeTable.Annotation = &entsql.Annotation{
  1004. Table: "sop_node",
  1005. }
  1006. SopStageTable.ForeignKeys[0].RefTable = SopTaskTable
  1007. SopStageTable.Annotation = &entsql.Annotation{
  1008. Table: "sop_stage",
  1009. }
  1010. SopTaskTable.Annotation = &entsql.Annotation{
  1011. Table: "sop_task",
  1012. }
  1013. TokenTable.ForeignKeys[0].RefTable = AgentTable
  1014. TokenTable.Annotation = &entsql.Annotation{
  1015. Table: "token",
  1016. }
  1017. TutorialTable.ForeignKeys[0].RefTable = EmployeeTable
  1018. TutorialTable.Annotation = &entsql.Annotation{
  1019. Table: "tutorial",
  1020. }
  1021. WorkExperienceTable.ForeignKeys[0].RefTable = EmployeeTable
  1022. WorkExperienceTable.Annotation = &entsql.Annotation{
  1023. Table: "work_experience",
  1024. }
  1025. WxTable.ForeignKeys[0].RefTable = AgentTable
  1026. WxTable.ForeignKeys[1].RefTable = AgentBaseTable
  1027. WxTable.ForeignKeys[2].RefTable = ServerTable
  1028. WxTable.Annotation = &entsql.Annotation{
  1029. Table: "wx",
  1030. }
  1031. WxCardTable.Annotation = &entsql.Annotation{
  1032. Table: "wx_card",
  1033. }
  1034. WxCardUserTable.Annotation = &entsql.Annotation{
  1035. Table: "wx_card_user",
  1036. }
  1037. WxCardVisitTable.Annotation = &entsql.Annotation{
  1038. Table: "wx_card_visit",
  1039. }
  1040. }