schema.go 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236
  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. // MessageRecordsColumns holds the columns for the "message_records" table.
  10. MessageRecordsColumns = []*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: "status", Type: field.TypeUint8, Nullable: true, Comment: "Status 1: normal 2: ban | 状态 1 正常 2 禁用", Default: 1},
  15. {Name: "bot_wxid", Type: field.TypeString, Comment: "机器人微信 id"},
  16. {Name: "contact_id", Type: field.TypeUint64, Nullable: true, Comment: "联系人 id"},
  17. {Name: "contact_type", Type: field.TypeInt, Comment: "类型:1好友,2群组,3企业微信联系人", Default: 1},
  18. {Name: "contact_wxid", Type: field.TypeString, Comment: "接收方微信 id", Default: ""},
  19. {Name: "content_type", Type: field.TypeInt, Comment: "内容类型 1 文本 2 文件", Default: 1},
  20. {Name: "content", Type: field.TypeString, Comment: "发送内容", Default: ""},
  21. {Name: "meta", Type: field.TypeJSON, Nullable: true, Comment: "元数据"},
  22. {Name: "error_detail", Type: field.TypeString, Comment: "异常原因", Default: ""},
  23. {Name: "send_time", Type: field.TypeTime, Nullable: true, Comment: "发送时间"},
  24. {Name: "source_type", Type: field.TypeInt, Comment: "源类型 1 点发 2 群发 3 SOP", Default: 1},
  25. {Name: "source_id", Type: field.TypeUint64, Nullable: true, Comment: "源 ID", Default: 1},
  26. {Name: "sub_source_id", Type: field.TypeUint64, Nullable: true, Comment: "次源 ID", Default: 1},
  27. {Name: "sop_node_node_messages", Type: field.TypeUint64, Nullable: true},
  28. {Name: "sop_stage_stage_messages", Type: field.TypeUint64, Nullable: true},
  29. }
  30. // MessageRecordsTable holds the schema information for the "message_records" table.
  31. MessageRecordsTable = &schema.Table{
  32. Name: "message_records",
  33. Columns: MessageRecordsColumns,
  34. PrimaryKey: []*schema.Column{MessageRecordsColumns[0]},
  35. ForeignKeys: []*schema.ForeignKey{
  36. {
  37. Symbol: "message_records_sop_node_node_messages",
  38. Columns: []*schema.Column{MessageRecordsColumns[16]},
  39. RefColumns: []*schema.Column{SopNodeColumns[0]},
  40. OnDelete: schema.SetNull,
  41. },
  42. {
  43. Symbol: "message_records_sop_stage_stage_messages",
  44. Columns: []*schema.Column{MessageRecordsColumns[17]},
  45. RefColumns: []*schema.Column{SopStageColumns[0]},
  46. OnDelete: schema.SetNull,
  47. },
  48. },
  49. }
  50. // SopNodeColumns holds the columns for the "sop_node" table.
  51. SopNodeColumns = []*schema.Column{
  52. {Name: "id", Type: field.TypeUint64, Increment: true},
  53. {Name: "created_at", Type: field.TypeTime, Comment: "Create Time | 创建日期"},
  54. {Name: "updated_at", Type: field.TypeTime, Comment: "Update Time | 修改日期"},
  55. {Name: "status", Type: field.TypeUint8, Nullable: true, Comment: "Status 1: normal 2: ban | 状态 1 正常 2 禁用", Default: 1},
  56. {Name: "parent_id", Type: field.TypeUint64, Comment: "父节点 ID"},
  57. {Name: "name", Type: field.TypeString, Comment: "节点名称", Default: ""},
  58. {Name: "condition_type", Type: field.TypeInt, Comment: "触发条件类型 1 客户回复后触发 2 超时后触发", Default: 1},
  59. {Name: "condition_list", Type: field.TypeJSON, Nullable: true, Comment: "触发语义列表 当为空时则代表用户回复任意内容后触发"},
  60. {Name: "no_reply_condition", Type: field.TypeUint64, Comment: "超时触发时间(分钟)", Default: 0},
  61. {Name: "action_message", Type: field.TypeJSON, Nullable: true, Comment: "命中后发送的消息内容"},
  62. {Name: "action_label", Type: field.TypeJSON, Nullable: true, Comment: "命中后需要打的标签"},
  63. {Name: "deleted_at", Type: field.TypeTime, Nullable: true, Comment: "Delete Time | 删除日期"},
  64. {Name: "stage_id", Type: field.TypeUint64, Comment: "阶段 ID"},
  65. }
  66. // SopNodeTable holds the schema information for the "sop_node" table.
  67. SopNodeTable = &schema.Table{
  68. Name: "sop_node",
  69. Columns: SopNodeColumns,
  70. PrimaryKey: []*schema.Column{SopNodeColumns[0]},
  71. ForeignKeys: []*schema.ForeignKey{
  72. {
  73. Symbol: "sop_node_sop_stage_stage_nodes",
  74. Columns: []*schema.Column{SopNodeColumns[12]},
  75. RefColumns: []*schema.Column{SopStageColumns[0]},
  76. OnDelete: schema.NoAction,
  77. },
  78. },
  79. Indexes: []*schema.Index{
  80. {
  81. Name: "sopnode_name",
  82. Unique: false,
  83. Columns: []*schema.Column{SopNodeColumns[5]},
  84. },
  85. },
  86. }
  87. // SopStageColumns holds the columns for the "sop_stage" table.
  88. SopStageColumns = []*schema.Column{
  89. {Name: "id", Type: field.TypeUint64, Increment: true},
  90. {Name: "created_at", Type: field.TypeTime, Comment: "Create Time | 创建日期"},
  91. {Name: "updated_at", Type: field.TypeTime, Comment: "Update Time | 修改日期"},
  92. {Name: "status", Type: field.TypeUint8, Nullable: true, Comment: "Status 1: normal 2: ban | 状态 1 正常 2 禁用", Default: 1},
  93. {Name: "name", Type: field.TypeString, Comment: "阶段名称", Default: ""},
  94. {Name: "condition_type", Type: field.TypeInt, Comment: "客群筛选条件类型 1 按标签筛选 2 按客户基本信息筛选", Default: 1},
  95. {Name: "condition_operator", Type: field.TypeInt, Comment: "筛选条件关系 1 满足所有条件(and) 2 满足任意条件(or)", Default: 1},
  96. {Name: "condition_list", Type: field.TypeJSON, Comment: "筛选条件列表"},
  97. {Name: "action_message", Type: field.TypeJSON, Nullable: true, Comment: "命中后发送的消息内容"},
  98. {Name: "action_label", Type: field.TypeJSON, Nullable: true, Comment: "命中后需要打的标签"},
  99. {Name: "index_sort", Type: field.TypeInt, Nullable: true, Comment: "阶段顺序", Default: 1},
  100. {Name: "deleted_at", Type: field.TypeTime, Nullable: true, Comment: "Delete Time | 删除日期"},
  101. {Name: "task_id", Type: field.TypeUint64, Comment: "SOP 任务 ID"},
  102. }
  103. // SopStageTable holds the schema information for the "sop_stage" table.
  104. SopStageTable = &schema.Table{
  105. Name: "sop_stage",
  106. Columns: SopStageColumns,
  107. PrimaryKey: []*schema.Column{SopStageColumns[0]},
  108. ForeignKeys: []*schema.ForeignKey{
  109. {
  110. Symbol: "sop_stage_sop_task_task_stages",
  111. Columns: []*schema.Column{SopStageColumns[12]},
  112. RefColumns: []*schema.Column{SopTaskColumns[0]},
  113. OnDelete: schema.NoAction,
  114. },
  115. },
  116. Indexes: []*schema.Index{
  117. {
  118. Name: "sopstage_name",
  119. Unique: false,
  120. Columns: []*schema.Column{SopStageColumns[4]},
  121. },
  122. },
  123. }
  124. // SopTaskColumns holds the columns for the "sop_task" table.
  125. SopTaskColumns = []*schema.Column{
  126. {Name: "id", Type: field.TypeUint64, Increment: true},
  127. {Name: "created_at", Type: field.TypeTime, Comment: "Create Time | 创建日期"},
  128. {Name: "updated_at", Type: field.TypeTime, Comment: "Update Time | 修改日期"},
  129. {Name: "status", Type: field.TypeUint8, Nullable: true, Comment: "Status 1: normal 2: ban | 状态 1 正常 2 禁用", Default: 1},
  130. {Name: "name", Type: field.TypeString, Comment: "SOP 任务名称"},
  131. {Name: "bot_wxid_list", Type: field.TypeJSON, Nullable: true, Comment: "机器人微信 id 列表"},
  132. {Name: "type", Type: field.TypeInt, Comment: "标签类型:1好友,2群组,3企业微信联系人", Default: 1},
  133. {Name: "plan_start_time", Type: field.TypeTime, Nullable: true, Comment: "任务计划开始时间"},
  134. {Name: "plan_end_time", Type: field.TypeTime, Nullable: true, Comment: "任务计划结束时间"},
  135. {Name: "creator_id", Type: field.TypeString, Nullable: true, Comment: "创建者 id"},
  136. {Name: "deleted_at", Type: field.TypeTime, Nullable: true, Comment: "Delete Time | 删除日期"},
  137. }
  138. // SopTaskTable holds the schema information for the "sop_task" table.
  139. SopTaskTable = &schema.Table{
  140. Name: "sop_task",
  141. Columns: SopTaskColumns,
  142. PrimaryKey: []*schema.Column{SopTaskColumns[0]},
  143. Indexes: []*schema.Index{
  144. {
  145. Name: "soptask_name",
  146. Unique: false,
  147. Columns: []*schema.Column{SopTaskColumns[4]},
  148. },
  149. },
  150. }
  151. // SysTasksColumns holds the columns for the "sys_tasks" table.
  152. SysTasksColumns = []*schema.Column{
  153. {Name: "id", Type: field.TypeUint64, Increment: true},
  154. {Name: "created_at", Type: field.TypeTime, Comment: "Create Time | 创建日期"},
  155. {Name: "updated_at", Type: field.TypeTime, Comment: "Update Time | 修改日期"},
  156. {Name: "status", Type: field.TypeUint8, Nullable: true, Comment: "Status 1: normal 2: ban | 状态 1 正常 2 禁用", Default: 1},
  157. {Name: "name", Type: field.TypeString},
  158. {Name: "task_group", Type: field.TypeString},
  159. {Name: "cron_expression", Type: field.TypeString},
  160. {Name: "pattern", Type: field.TypeString},
  161. {Name: "payload", Type: field.TypeString},
  162. }
  163. // SysTasksTable holds the schema information for the "sys_tasks" table.
  164. SysTasksTable = &schema.Table{
  165. Name: "sys_tasks",
  166. Columns: SysTasksColumns,
  167. PrimaryKey: []*schema.Column{SysTasksColumns[0]},
  168. Indexes: []*schema.Index{
  169. {
  170. Name: "task_pattern",
  171. Unique: true,
  172. Columns: []*schema.Column{SysTasksColumns[7]},
  173. },
  174. },
  175. }
  176. // SysTaskLogsColumns holds the columns for the "sys_task_logs" table.
  177. SysTaskLogsColumns = []*schema.Column{
  178. {Name: "id", Type: field.TypeUint64, Increment: true},
  179. {Name: "started_at", Type: field.TypeTime, Comment: "Task Started Time | 任务启动时间"},
  180. {Name: "finished_at", Type: field.TypeTime, Comment: "Task Finished Time | 任务完成时间"},
  181. {Name: "result", Type: field.TypeUint8, Comment: "The Task Process Result | 任务执行结果"},
  182. {Name: "task_task_logs", Type: field.TypeUint64, Nullable: true},
  183. }
  184. // SysTaskLogsTable holds the schema information for the "sys_task_logs" table.
  185. SysTaskLogsTable = &schema.Table{
  186. Name: "sys_task_logs",
  187. Columns: SysTaskLogsColumns,
  188. PrimaryKey: []*schema.Column{SysTaskLogsColumns[0]},
  189. ForeignKeys: []*schema.ForeignKey{
  190. {
  191. Symbol: "sys_task_logs_sys_tasks_task_logs",
  192. Columns: []*schema.Column{SysTaskLogsColumns[4]},
  193. RefColumns: []*schema.Column{SysTasksColumns[0]},
  194. OnDelete: schema.SetNull,
  195. },
  196. },
  197. }
  198. // Tables holds all the tables in the schema.
  199. Tables = []*schema.Table{
  200. MessageRecordsTable,
  201. SopNodeTable,
  202. SopStageTable,
  203. SopTaskTable,
  204. SysTasksTable,
  205. SysTaskLogsTable,
  206. }
  207. )
  208. func init() {
  209. MessageRecordsTable.ForeignKeys[0].RefTable = SopNodeTable
  210. MessageRecordsTable.ForeignKeys[1].RefTable = SopStageTable
  211. MessageRecordsTable.Annotation = &entsql.Annotation{
  212. Table: "message_records",
  213. }
  214. SopNodeTable.ForeignKeys[0].RefTable = SopStageTable
  215. SopNodeTable.Annotation = &entsql.Annotation{
  216. Table: "sop_node",
  217. }
  218. SopStageTable.ForeignKeys[0].RefTable = SopTaskTable
  219. SopStageTable.Annotation = &entsql.Annotation{
  220. Table: "sop_stage",
  221. }
  222. SopTaskTable.Annotation = &entsql.Annotation{
  223. Table: "sop_task",
  224. }
  225. SysTasksTable.Annotation = &entsql.Annotation{
  226. Table: "sys_tasks",
  227. }
  228. SysTaskLogsTable.ForeignKeys[0].RefTable = SysTasksTable
  229. SysTaskLogsTable.Annotation = &entsql.Annotation{
  230. Table: "sys_task_logs",
  231. }
  232. }