// 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 ( // BatchMsgColumns holds the columns for the "batch_msg" table. BatchMsgColumns = []*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: "deleted_at", Type: field.TypeTime, Nullable: true, Comment: "Delete Time | 删除日期"}, {Name: "status", Type: field.TypeUint8, Nullable: true, Comment: "状态 0 未开始 1 开始发送 2 发送完成 3 发送中止"}, {Name: "batch_no", Type: field.TypeString, Unique: true, Nullable: true, Comment: "批次号"}, {Name: "fromwxid", Type: field.TypeString, Nullable: true, Comment: "发送方微信ID"}, {Name: "msg", Type: field.TypeString, Nullable: true, Comment: "内容"}, {Name: "tag", Type: field.TypeString, Nullable: true, Comment: "发送规则 all 全部 tag1,tag2 按tag发送"}, {Name: "total", Type: field.TypeInt32, Nullable: true, Comment: "总数"}, {Name: "success", Type: field.TypeInt32, Nullable: true, Comment: "成功数量"}, {Name: "fail", Type: field.TypeInt32, Nullable: true, Comment: "失败数量"}, {Name: "start_time", Type: field.TypeTime, Nullable: true, Comment: "开始时间"}, {Name: "stop_time", Type: field.TypeTime, Nullable: true, Comment: "结束时间"}, } // BatchMsgTable holds the schema information for the "batch_msg" table. BatchMsgTable = &schema.Table{ Name: "batch_msg", Columns: BatchMsgColumns, PrimaryKey: []*schema.Column{BatchMsgColumns[0]}, Indexes: []*schema.Index{ { Name: "batchmsg_batch_no", Unique: true, Columns: []*schema.Column{BatchMsgColumns[5]}, }, }, } // ContactsColumns holds the columns for the "contacts" table. ContactsColumns = []*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: "deleted_at", Type: field.TypeTime, Nullable: true, Comment: "Delete Time | 删除日期"}, {Name: "wx_wxid", Type: field.TypeString, Nullable: true, Comment: "属主微信id", Default: ""}, {Name: "type", Type: field.TypeInt, Nullable: true, Comment: "联系人类型:1好友,2群组,3公众号,4企业微信联系人", Default: 1}, {Name: "wxid", Type: field.TypeString, Comment: "微信id 公众号微信ID", Default: ""}, {Name: "account", Type: field.TypeString, Comment: "微信账号", Default: ""}, {Name: "nickname", Type: field.TypeString, Comment: "微信昵称 群备注名称", Default: ""}, {Name: "markname", Type: field.TypeString, Comment: "备注名", Default: ""}, {Name: "headimg", Type: field.TypeString, Comment: "头像", Default: ""}, {Name: "sex", Type: field.TypeInt, Comment: "性别 0未知 1男 2女", Default: 0}, {Name: "starrole", Type: field.TypeString, Comment: "星标 65/67=星标 1/3=未星标", Default: ""}, {Name: "dontseeit", Type: field.TypeInt, Comment: "不让他看我的朋友圈 0可以看 1不让看", Default: 0}, {Name: "dontseeme", Type: field.TypeInt, Comment: "不看他的朋友圈 0可以看 1不看 1=开启了不看他 128/129=仅聊天", Default: 0}, {Name: "lag", Type: field.TypeString, Comment: "所属标签id清单,多开会用逗号隔开", Default: ""}, {Name: "gid", Type: field.TypeString, Comment: "群组id", Default: ""}, {Name: "gname", Type: field.TypeString, Comment: "群组名称", Default: ""}, {Name: "v3", Type: field.TypeString, Comment: "v3数据", Default: ""}, } // ContactsTable holds the schema information for the "contacts" table. ContactsTable = &schema.Table{ Name: "contacts", Columns: ContactsColumns, PrimaryKey: []*schema.Column{ContactsColumns[0]}, Indexes: []*schema.Index{ { Name: "contact_wx_wxid_wxid", Unique: true, Columns: []*schema.Column{ContactsColumns[5], ContactsColumns[7]}, }, { Name: "contact_wxid", Unique: false, Columns: []*schema.Column{ContactsColumns[7]}, }, { Name: "contact_type", Unique: false, Columns: []*schema.Column{ContactsColumns[6]}, }, { Name: "contact_gid", Unique: false, Columns: []*schema.Column{ContactsColumns[17]}, }, }, } // LabelsColumns holds the columns for the "labels" table. LabelsColumns = []*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: "deleted_at", Type: field.TypeTime, Nullable: true, Comment: "Delete Time | 删除日期"}, {Name: "type", Type: field.TypeInt, Comment: "标签类型:1好友,2群组,3公众号,4企业微信联系人", Default: 1}, {Name: "name", Type: field.TypeString, Comment: "标签名称", Default: ""}, {Name: "from", Type: field.TypeInt, Comment: "标签来源:1后台创建 2个微同步", Default: 1}, {Name: "mode", Type: field.TypeInt, Comment: "标签模式:1动态 2静态", Default: 1}, {Name: "conditions", Type: field.TypeString, Nullable: true, Comment: "标签的触达条件", Default: ""}, } // LabelsTable holds the schema information for the "labels" table. LabelsTable = &schema.Table{ Name: "labels", Columns: LabelsColumns, PrimaryKey: []*schema.Column{LabelsColumns[0]}, Indexes: []*schema.Index{ { Name: "label_name_from_mode", Unique: true, Columns: []*schema.Column{LabelsColumns[6], LabelsColumns[7], LabelsColumns[8]}, }, }, } // LabelRelationshipsColumns holds the columns for the "label_relationships" table. LabelRelationshipsColumns = []*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: "deleted_at", Type: field.TypeTime, Nullable: true, Comment: "Delete Time | 删除日期"}, {Name: "contact_id", Type: field.TypeUint64, Comment: "联系人 ID", Default: 1}, {Name: "label_id", Type: field.TypeUint64, Comment: "标签 ID", Default: 1}, } // LabelRelationshipsTable holds the schema information for the "label_relationships" table. LabelRelationshipsTable = &schema.Table{ Name: "label_relationships", Columns: LabelRelationshipsColumns, PrimaryKey: []*schema.Column{LabelRelationshipsColumns[0]}, ForeignKeys: []*schema.ForeignKey{ { Symbol: "label_relationships_contacts_contact_relationships", Columns: []*schema.Column{LabelRelationshipsColumns[5]}, RefColumns: []*schema.Column{ContactsColumns[0]}, OnDelete: schema.NoAction, }, { Symbol: "label_relationships_labels_label_relationships", Columns: []*schema.Column{LabelRelationshipsColumns[6]}, RefColumns: []*schema.Column{LabelsColumns[0]}, OnDelete: schema.NoAction, }, }, Indexes: []*schema.Index{ { Name: "labelrelationship_label_id", Unique: false, Columns: []*schema.Column{LabelRelationshipsColumns[6]}, }, { Name: "labelrelationship_contact_id", Unique: false, Columns: []*schema.Column{LabelRelationshipsColumns[5]}, }, }, } // MessagesColumns holds the columns for the "messages" table. MessagesColumns = []*schema.Column{ {Name: "id", Type: field.TypeInt, Increment: true}, {Name: "wx_wxid", Type: field.TypeString, Nullable: true, Comment: "属主微信id", Default: ""}, {Name: "wxid", Type: field.TypeString, Comment: "微信id 公众号微信ID", Default: ""}, {Name: "content", Type: field.TypeString, Comment: "微信消息内容", Default: ""}, } // MessagesTable holds the schema information for the "messages" table. MessagesTable = &schema.Table{ Name: "messages", Columns: MessagesColumns, PrimaryKey: []*schema.Column{MessagesColumns[0]}, } // MessageRecordssColumns holds the columns for the "message_recordss" table. MessageRecordssColumns = []*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: "deleted_at", Type: field.TypeTime, Nullable: true, Comment: "Delete Time | 删除日期"}, {Name: "bot_wxid", Type: field.TypeString, 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: "contact_id", Type: field.TypeUint64, Nullable: true, Comment: "联系人 id"}, {Name: "sub_source_id", Type: field.TypeUint64, Nullable: true, Comment: "次源 ID", Default: 1}, {Name: "source_id", Type: field.TypeUint64, Nullable: true, Comment: "源 ID", Default: 1}, } // MessageRecordssTable holds the schema information for the "message_recordss" table. MessageRecordssTable = &schema.Table{ Name: "message_recordss", Columns: MessageRecordssColumns, PrimaryKey: []*schema.Column{MessageRecordssColumns[0]}, ForeignKeys: []*schema.ForeignKey{ { Symbol: "message_recordss_contacts_contact_messages", Columns: []*schema.Column{MessageRecordssColumns[14]}, RefColumns: []*schema.Column{ContactsColumns[0]}, OnDelete: schema.SetNull, }, { Symbol: "message_recordss_sop_nodes_node_messages", Columns: []*schema.Column{MessageRecordssColumns[15]}, RefColumns: []*schema.Column{SopNodesColumns[0]}, OnDelete: schema.SetNull, }, { Symbol: "message_recordss_sop_stages_stage_messages", Columns: []*schema.Column{MessageRecordssColumns[16]}, RefColumns: []*schema.Column{SopStagesColumns[0]}, OnDelete: schema.SetNull, }, }, Indexes: []*schema.Index{ { Name: "messagerecords_source_type", Unique: false, Columns: []*schema.Column{MessageRecordssColumns[13]}, }, }, } // ServersColumns holds the columns for the "servers" table. ServersColumns = []*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: "deleted_at", Type: field.TypeTime, Nullable: true, Comment: "Delete Time | 删除日期"}, {Name: "name", Type: field.TypeString, Comment: "名称"}, {Name: "public_ip", Type: field.TypeString, Comment: "公网ip"}, {Name: "private_ip", Type: field.TypeString, Comment: "内网ip"}, {Name: "admin_port", Type: field.TypeString, Comment: "管理端口"}, } // ServersTable holds the schema information for the "servers" table. ServersTable = &schema.Table{ Name: "servers", Columns: ServersColumns, PrimaryKey: []*schema.Column{ServersColumns[0]}, Indexes: []*schema.Index{ { Name: "server_name", Unique: false, Columns: []*schema.Column{ServersColumns[5]}, }, { Name: "server_private_ip", Unique: false, Columns: []*schema.Column{ServersColumns[7]}, }, { Name: "server_public_ip", Unique: true, Columns: []*schema.Column{ServersColumns[6]}, }, }, } // SopNodesColumns holds the columns for the "sop_nodes" table. SopNodesColumns = []*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: "deleted_at", Type: field.TypeTime, Nullable: true, Comment: "Delete Time | 删除日期"}, {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: "stage_id", Type: field.TypeUint64, Comment: "阶段 ID"}, } // SopNodesTable holds the schema information for the "sop_nodes" table. SopNodesTable = &schema.Table{ Name: "sop_nodes", Columns: SopNodesColumns, PrimaryKey: []*schema.Column{SopNodesColumns[0]}, ForeignKeys: []*schema.ForeignKey{ { Symbol: "sop_nodes_sop_stages_stage_nodes", Columns: []*schema.Column{SopNodesColumns[12]}, RefColumns: []*schema.Column{SopStagesColumns[0]}, OnDelete: schema.NoAction, }, }, Indexes: []*schema.Index{ { Name: "sopnode_name", Unique: false, Columns: []*schema.Column{SopNodesColumns[6]}, }, }, } // SopStagesColumns holds the columns for the "sop_stages" table. SopStagesColumns = []*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: "deleted_at", Type: field.TypeTime, Nullable: true, Comment: "Delete Time | 删除日期"}, {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: "task_id", Type: field.TypeUint64, Comment: "SOP 任务 ID"}, } // SopStagesTable holds the schema information for the "sop_stages" table. SopStagesTable = &schema.Table{ Name: "sop_stages", Columns: SopStagesColumns, PrimaryKey: []*schema.Column{SopStagesColumns[0]}, ForeignKeys: []*schema.ForeignKey{ { Symbol: "sop_stages_sop_tasks_task_stages", Columns: []*schema.Column{SopStagesColumns[12]}, RefColumns: []*schema.Column{SopTasksColumns[0]}, OnDelete: schema.NoAction, }, }, Indexes: []*schema.Index{ { Name: "sopstage_name", Unique: false, Columns: []*schema.Column{SopStagesColumns[5]}, }, }, } // SopTasksColumns holds the columns for the "sop_tasks" table. SopTasksColumns = []*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: "deleted_at", Type: field.TypeTime, Nullable: true, Comment: "Delete Time | 删除日期"}, {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"}, } // SopTasksTable holds the schema information for the "sop_tasks" table. SopTasksTable = &schema.Table{ Name: "sop_tasks", Columns: SopTasksColumns, PrimaryKey: []*schema.Column{SopTasksColumns[0]}, Indexes: []*schema.Index{ { Name: "soptask_name", Unique: false, Columns: []*schema.Column{SopTasksColumns[5]}, }, }, } // WxsColumns holds the columns for the "wxs" table. WxsColumns = []*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: "deleted_at", Type: field.TypeTime, Nullable: true, Comment: "Delete Time | 删除日期"}, {Name: "port", Type: field.TypeString, Comment: "端口号", Default: ""}, {Name: "process_id", Type: field.TypeString, Comment: "进程号", Default: ""}, {Name: "callback", Type: field.TypeString, Comment: "回调地址", Default: ""}, {Name: "wxid", Type: field.TypeString, Comment: "微信id", Default: ""}, {Name: "account", Type: field.TypeString, Comment: "微信账号", Default: ""}, {Name: "nickname", Type: field.TypeString, Comment: "微信昵称", Default: ""}, {Name: "tel", Type: field.TypeString, Comment: "手机号", Default: ""}, {Name: "head_big", Type: field.TypeString, Comment: "微信头像", Default: ""}, {Name: "server_id", Type: field.TypeUint64, Nullable: true, Comment: "服务器id", Default: 0}, } // WxsTable holds the schema information for the "wxs" table. WxsTable = &schema.Table{ Name: "wxs", Columns: WxsColumns, PrimaryKey: []*schema.Column{WxsColumns[0]}, ForeignKeys: []*schema.ForeignKey{ { Symbol: "wxs_servers_wxs", Columns: []*schema.Column{WxsColumns[13]}, RefColumns: []*schema.Column{ServersColumns[0]}, OnDelete: schema.SetNull, }, }, Indexes: []*schema.Index{ { Name: "wx_server_id_port", Unique: true, Columns: []*schema.Column{WxsColumns[13], WxsColumns[5]}, }, { Name: "wx_wxid", Unique: true, Columns: []*schema.Column{WxsColumns[8]}, }, { Name: "wx_account", Unique: false, Columns: []*schema.Column{WxsColumns[9]}, }, { Name: "wx_nickname", Unique: false, Columns: []*schema.Column{WxsColumns[10]}, }, { Name: "wx_tel", Unique: false, Columns: []*schema.Column{WxsColumns[11]}, }, }, } // Tables holds all the tables in the schema. Tables = []*schema.Table{ BatchMsgTable, ContactsTable, LabelsTable, LabelRelationshipsTable, MessagesTable, MessageRecordssTable, ServersTable, SopNodesTable, SopStagesTable, SopTasksTable, WxsTable, } ) func init() { BatchMsgTable.Annotation = &entsql.Annotation{ Table: "batch_msg", } ContactsTable.Annotation = &entsql.Annotation{ Table: "contacts", } LabelsTable.Annotation = &entsql.Annotation{ Table: "labels", } LabelRelationshipsTable.ForeignKeys[0].RefTable = ContactsTable LabelRelationshipsTable.ForeignKeys[1].RefTable = LabelsTable LabelRelationshipsTable.Annotation = &entsql.Annotation{ Table: "label_relationships", } MessagesTable.Annotation = &entsql.Annotation{ Table: "messages", } MessageRecordssTable.ForeignKeys[0].RefTable = ContactsTable MessageRecordssTable.ForeignKeys[1].RefTable = SopNodesTable MessageRecordssTable.ForeignKeys[2].RefTable = SopStagesTable MessageRecordssTable.Annotation = &entsql.Annotation{ Table: "message_recordss", } ServersTable.Annotation = &entsql.Annotation{ Table: "servers", } SopNodesTable.ForeignKeys[0].RefTable = SopStagesTable SopNodesTable.Annotation = &entsql.Annotation{ Table: "sop_nodes", } SopStagesTable.ForeignKeys[0].RefTable = SopTasksTable SopStagesTable.Annotation = &entsql.Annotation{ Table: "sop_stages", } SopTasksTable.Annotation = &entsql.Annotation{ Table: "sop_tasks", } WxsTable.ForeignKeys[0].RefTable = ServersTable WxsTable.Annotation = &entsql.Annotation{ Table: "wxs", } }