// Code generated by ent, DO NOT EDIT. package migrate import ( "entgo.io/ent/dialect/entsql" "entgo.io/ent/dialect/sql/schema" "entgo.io/ent/schema/field" ) var ( // MessageRecordsColumns holds the columns for the "message_records" table. MessageRecordsColumns = []*schema.Column{ {Name: "id", Type: field.TypeUint64, Increment: true}, {Name: "created_at", Type: field.TypeTime, Comment: "Create Time | 创建日期"}, {Name: "updated_at", Type: field.TypeTime, Comment: "Update Time | 修改日期"}, {Name: "status", Type: field.TypeUint8, Nullable: true, Comment: "Status 1: normal 2: ban | 状态 1 正常 2 禁用", Default: 1}, {Name: "bot_wxid", Type: field.TypeString, Comment: "机器人微信 id"}, {Name: "contact_id", Type: field.TypeUint64, Nullable: true, Comment: "联系人 id"}, {Name: "contact_type", Type: field.TypeInt, Comment: "类型:1好友,2群组,3企业微信联系人", Default: 1}, {Name: "contact_wxid", Type: field.TypeString, Comment: "接收方微信 id", Default: ""}, {Name: "content_type", Type: field.TypeInt, Comment: "内容类型 1 文本 2 文件", Default: 1}, {Name: "content", Type: field.TypeString, Comment: "发送内容", Default: ""}, {Name: "meta", Type: field.TypeJSON, Nullable: true, Comment: "元数据"}, {Name: "error_detail", Type: field.TypeString, Comment: "异常原因", Default: ""}, {Name: "send_time", Type: field.TypeTime, Nullable: true, Comment: "发送时间"}, {Name: "source_type", Type: field.TypeInt, Comment: "源类型 1 点发 2 群发 3 SOP", Default: 1}, {Name: "source_id", Type: field.TypeUint64, Nullable: true, Comment: "源 ID", Default: 1}, {Name: "sub_source_id", Type: field.TypeUint64, Nullable: true, Comment: "次源 ID", Default: 1}, {Name: "sop_node_node_messages", Type: field.TypeUint64, Nullable: true}, {Name: "sop_stage_stage_messages", Type: field.TypeUint64, Nullable: true}, } // MessageRecordsTable holds the schema information for the "message_records" table. MessageRecordsTable = &schema.Table{ Name: "message_records", Columns: MessageRecordsColumns, PrimaryKey: []*schema.Column{MessageRecordsColumns[0]}, ForeignKeys: []*schema.ForeignKey{ { Symbol: "message_records_sop_node_node_messages", Columns: []*schema.Column{MessageRecordsColumns[16]}, RefColumns: []*schema.Column{SopNodeColumns[0]}, OnDelete: schema.SetNull, }, { Symbol: "message_records_sop_stage_stage_messages", Columns: []*schema.Column{MessageRecordsColumns[17]}, RefColumns: []*schema.Column{SopStageColumns[0]}, OnDelete: schema.SetNull, }, }, } // SopNodeColumns holds the columns for the "sop_node" table. SopNodeColumns = []*schema.Column{ {Name: "id", Type: field.TypeUint64, Increment: true}, {Name: "created_at", Type: field.TypeTime, Comment: "Create Time | 创建日期"}, {Name: "updated_at", Type: field.TypeTime, Comment: "Update Time | 修改日期"}, {Name: "status", Type: field.TypeUint8, Nullable: true, Comment: "Status 1: normal 2: ban | 状态 1 正常 2 禁用", Default: 1}, {Name: "parent_id", Type: field.TypeUint64, Comment: "父节点 ID"}, {Name: "name", Type: field.TypeString, Comment: "节点名称", Default: ""}, {Name: "condition_type", Type: field.TypeInt, Comment: "触发条件类型 1 客户回复后触发 2 超时后触发", Default: 1}, {Name: "condition_list", Type: field.TypeJSON, Nullable: true, Comment: "触发语义列表 当为空时则代表用户回复任意内容后触发"}, {Name: "no_reply_condition", Type: field.TypeUint64, Comment: "超时触发时间(分钟)", Default: 0}, {Name: "action_message", Type: field.TypeJSON, Nullable: true, Comment: "命中后发送的消息内容"}, {Name: "action_label", Type: field.TypeJSON, Nullable: true, Comment: "命中后需要打的标签"}, {Name: "deleted_at", Type: field.TypeTime, Nullable: true, Comment: "Delete Time | 删除日期"}, {Name: "stage_id", Type: field.TypeUint64, Comment: "阶段 ID"}, } // SopNodeTable holds the schema information for the "sop_node" table. SopNodeTable = &schema.Table{ Name: "sop_node", Columns: SopNodeColumns, PrimaryKey: []*schema.Column{SopNodeColumns[0]}, ForeignKeys: []*schema.ForeignKey{ { Symbol: "sop_node_sop_stage_stage_nodes", Columns: []*schema.Column{SopNodeColumns[12]}, RefColumns: []*schema.Column{SopStageColumns[0]}, OnDelete: schema.NoAction, }, }, Indexes: []*schema.Index{ { Name: "sopnode_name", Unique: false, Columns: []*schema.Column{SopNodeColumns[5]}, }, }, } // SopStageColumns holds the columns for the "sop_stage" table. SopStageColumns = []*schema.Column{ {Name: "id", Type: field.TypeUint64, Increment: true}, {Name: "created_at", Type: field.TypeTime, Comment: "Create Time | 创建日期"}, {Name: "updated_at", Type: field.TypeTime, Comment: "Update Time | 修改日期"}, {Name: "status", Type: field.TypeUint8, Nullable: true, Comment: "Status 1: normal 2: ban | 状态 1 正常 2 禁用", Default: 1}, {Name: "name", Type: field.TypeString, Comment: "阶段名称", Default: ""}, {Name: "condition_type", Type: field.TypeInt, Comment: "客群筛选条件类型 1 按标签筛选 2 按客户基本信息筛选", Default: 1}, {Name: "condition_operator", Type: field.TypeInt, Comment: "筛选条件关系 1 满足所有条件(and) 2 满足任意条件(or)", Default: 1}, {Name: "condition_list", Type: field.TypeJSON, Comment: "筛选条件列表"}, {Name: "action_message", Type: field.TypeJSON, Nullable: true, Comment: "命中后发送的消息内容"}, {Name: "action_label", Type: field.TypeJSON, Nullable: true, Comment: "命中后需要打的标签"}, {Name: "index_sort", Type: field.TypeInt, Nullable: true, Comment: "阶段顺序", Default: 1}, {Name: "deleted_at", Type: field.TypeTime, Nullable: true, Comment: "Delete Time | 删除日期"}, {Name: "task_id", Type: field.TypeUint64, Comment: "SOP 任务 ID"}, } // SopStageTable holds the schema information for the "sop_stage" table. SopStageTable = &schema.Table{ Name: "sop_stage", Columns: SopStageColumns, PrimaryKey: []*schema.Column{SopStageColumns[0]}, ForeignKeys: []*schema.ForeignKey{ { Symbol: "sop_stage_sop_task_task_stages", Columns: []*schema.Column{SopStageColumns[12]}, RefColumns: []*schema.Column{SopTaskColumns[0]}, OnDelete: schema.NoAction, }, }, Indexes: []*schema.Index{ { Name: "sopstage_name", Unique: false, Columns: []*schema.Column{SopStageColumns[4]}, }, }, } // SopTaskColumns holds the columns for the "sop_task" table. SopTaskColumns = []*schema.Column{ {Name: "id", Type: field.TypeUint64, Increment: true}, {Name: "created_at", Type: field.TypeTime, Comment: "Create Time | 创建日期"}, {Name: "updated_at", Type: field.TypeTime, Comment: "Update Time | 修改日期"}, {Name: "status", Type: field.TypeUint8, Nullable: true, Comment: "Status 1: normal 2: ban | 状态 1 正常 2 禁用", Default: 1}, {Name: "name", Type: field.TypeString, Comment: "SOP 任务名称"}, {Name: "bot_wxid_list", Type: field.TypeJSON, Nullable: true, Comment: "机器人微信 id 列表"}, {Name: "type", Type: field.TypeInt, Comment: "标签类型:1好友,2群组,3企业微信联系人", Default: 1}, {Name: "plan_start_time", Type: field.TypeTime, Nullable: true, Comment: "任务计划开始时间"}, {Name: "plan_end_time", Type: field.TypeTime, Nullable: true, Comment: "任务计划结束时间"}, {Name: "creator_id", Type: field.TypeString, Nullable: true, Comment: "创建者 id"}, {Name: "deleted_at", Type: field.TypeTime, Nullable: true, Comment: "Delete Time | 删除日期"}, } // SopTaskTable holds the schema information for the "sop_task" table. SopTaskTable = &schema.Table{ Name: "sop_task", Columns: SopTaskColumns, PrimaryKey: []*schema.Column{SopTaskColumns[0]}, Indexes: []*schema.Index{ { Name: "soptask_name", Unique: false, Columns: []*schema.Column{SopTaskColumns[4]}, }, }, } // SysTasksColumns holds the columns for the "sys_tasks" table. SysTasksColumns = []*schema.Column{ {Name: "id", Type: field.TypeUint64, Increment: true}, {Name: "created_at", Type: field.TypeTime, Comment: "Create Time | 创建日期"}, {Name: "updated_at", Type: field.TypeTime, Comment: "Update Time | 修改日期"}, {Name: "status", Type: field.TypeUint8, Nullable: true, Comment: "Status 1: normal 2: ban | 状态 1 正常 2 禁用", Default: 1}, {Name: "name", Type: field.TypeString}, {Name: "task_group", Type: field.TypeString}, {Name: "cron_expression", Type: field.TypeString}, {Name: "pattern", Type: field.TypeString}, {Name: "payload", Type: field.TypeString}, } // SysTasksTable holds the schema information for the "sys_tasks" table. SysTasksTable = &schema.Table{ Name: "sys_tasks", Columns: SysTasksColumns, PrimaryKey: []*schema.Column{SysTasksColumns[0]}, Indexes: []*schema.Index{ { Name: "task_pattern", Unique: true, Columns: []*schema.Column{SysTasksColumns[7]}, }, }, } // SysTaskLogsColumns holds the columns for the "sys_task_logs" table. SysTaskLogsColumns = []*schema.Column{ {Name: "id", Type: field.TypeUint64, Increment: true}, {Name: "started_at", Type: field.TypeTime, Comment: "Task Started Time | 任务启动时间"}, {Name: "finished_at", Type: field.TypeTime, Comment: "Task Finished Time | 任务完成时间"}, {Name: "result", Type: field.TypeUint8, Comment: "The Task Process Result | 任务执行结果"}, {Name: "task_task_logs", Type: field.TypeUint64, Nullable: true}, } // SysTaskLogsTable holds the schema information for the "sys_task_logs" table. SysTaskLogsTable = &schema.Table{ Name: "sys_task_logs", Columns: SysTaskLogsColumns, PrimaryKey: []*schema.Column{SysTaskLogsColumns[0]}, ForeignKeys: []*schema.ForeignKey{ { Symbol: "sys_task_logs_sys_tasks_task_logs", Columns: []*schema.Column{SysTaskLogsColumns[4]}, RefColumns: []*schema.Column{SysTasksColumns[0]}, OnDelete: schema.SetNull, }, }, } // Tables holds all the tables in the schema. Tables = []*schema.Table{ MessageRecordsTable, SopNodeTable, SopStageTable, SopTaskTable, SysTasksTable, SysTaskLogsTable, } ) func init() { MessageRecordsTable.ForeignKeys[0].RefTable = SopNodeTable MessageRecordsTable.ForeignKeys[1].RefTable = SopStageTable MessageRecordsTable.Annotation = &entsql.Annotation{ Table: "message_records", } SopNodeTable.ForeignKeys[0].RefTable = SopStageTable SopNodeTable.Annotation = &entsql.Annotation{ Table: "sop_node", } SopStageTable.ForeignKeys[0].RefTable = SopTaskTable SopStageTable.Annotation = &entsql.Annotation{ Table: "sop_stage", } SopTaskTable.Annotation = &entsql.Annotation{ Table: "sop_task", } SysTasksTable.Annotation = &entsql.Annotation{ Table: "sys_tasks", } SysTaskLogsTable.ForeignKeys[0].RefTable = SysTasksTable SysTaskLogsTable.Annotation = &entsql.Annotation{ Table: "sys_task_logs", } }