Files
likedream/internal/ent/migrate/schema.go
T
2025-11-01 21:38:33 +08:00

430 lines
18 KiB
Go

// ENT数据库文件,请勿编辑。
package migrate
import (
"entgo.io/ent/dialect/entsql"
"entgo.io/ent/dialect/sql/schema"
"entgo.io/ent/schema/field"
)
var (
// CpImageColumns holds the columns for the "cp_image" table.
CpImageColumns = []*schema.Column{
{Name: "id", Type: field.TypeInt64, Increment: true},
{Name: "create_time", Type: field.TypeString, SchemaType: map[string]string{"mysql": "datetime", "postgres": "timestamp", "sqlite3": "datetime"}},
{Name: "update_time", Type: field.TypeString, SchemaType: map[string]string{"mysql": "datetime", "postgres": "timestamp", "sqlite3": "datetime"}},
{Name: "image_id", Type: field.TypeUUID, Unique: true},
{Name: "key", Type: field.TypeString},
{Name: "content_type", Type: field.TypeString},
{Name: "content_length", Type: field.TypeInt64},
{Name: "user_id", Type: field.TypeInt64},
}
// CpImageTable holds the schema information for the "cp_image" table.
CpImageTable = &schema.Table{
Name: "cp_image",
Columns: CpImageColumns,
PrimaryKey: []*schema.Column{CpImageColumns[0]},
ForeignKeys: []*schema.ForeignKey{
{
Symbol: "cp_image_sys_user_images",
Columns: []*schema.Column{CpImageColumns[7]},
RefColumns: []*schema.Column{SysUserColumns[0]},
OnDelete: schema.NoAction,
},
},
}
// CpSchoolsColumns holds the columns for the "cp_schools" table.
CpSchoolsColumns = []*schema.Column{
{Name: "id", Type: field.TypeString, Unique: true},
{Name: "name", Type: field.TypeString},
{Name: "name_pinyin", Type: field.TypeString},
{Name: "icon_img", Type: field.TypeString, Nullable: true},
}
// CpSchoolsTable holds the schema information for the "cp_schools" table.
CpSchoolsTable = &schema.Table{
Name: "cp_schools",
Columns: CpSchoolsColumns,
PrimaryKey: []*schema.Column{CpSchoolsColumns[0]},
}
// CpTasksColumns holds the columns for the "cp_tasks" table.
CpTasksColumns = []*schema.Column{
{Name: "id", Type: field.TypeInt64, Increment: true},
{Name: "task_type", Type: field.TypeEnum, Enums: []string{"collection", "sign", "sleep_check"}},
{Name: "title", Type: field.TypeString},
{Name: "frequency", Type: field.TypeInt, Default: 0},
{Name: "task_status", Type: field.TypeEnum, Enums: []string{"not_start", "doing", "done", "fail", "pause", "unknown"}},
{Name: "success_count", Type: field.TypeInt, Default: 0},
{Name: "form_data", Type: field.TypeString, Nullable: true, Size: 2147483647},
{Name: "step", Type: field.TypeEnum, Enums: []string{"form", "execute", "complete"}},
{Name: "notification_type", Type: field.TypeEnum, Enums: []string{"none", "cp_user_email", "system_user_email"}},
{Name: "execute_hour", Type: field.TypeInt, Nullable: true},
{Name: "execute_minute", Type: field.TypeInt, Nullable: true},
{Name: "next_execute_time", Type: field.TypeInt64, Nullable: true},
{Name: "cp_user_id", Type: field.TypeInt64},
{Name: "user_id", Type: field.TypeInt64},
}
// CpTasksTable holds the schema information for the "cp_tasks" table.
CpTasksTable = &schema.Table{
Name: "cp_tasks",
Columns: CpTasksColumns,
PrimaryKey: []*schema.Column{CpTasksColumns[0]},
ForeignKeys: []*schema.ForeignKey{
{
Symbol: "cp_tasks_cp_users_cptasks",
Columns: []*schema.Column{CpTasksColumns[12]},
RefColumns: []*schema.Column{CpUsersColumns[0]},
OnDelete: schema.NoAction,
},
{
Symbol: "cp_tasks_sys_user_cp_task",
Columns: []*schema.Column{CpTasksColumns[13]},
RefColumns: []*schema.Column{SysUserColumns[0]},
OnDelete: schema.NoAction,
},
},
}
// CpTaskLogsColumns holds the columns for the "cp_task_logs" table.
CpTaskLogsColumns = []*schema.Column{
{Name: "id", Type: field.TypeInt64, Increment: true},
{Name: "is_success", Type: field.TypeBool},
{Name: "error_message", Type: field.TypeString, Nullable: true},
{Name: "real_name", Type: field.TypeString, Nullable: true},
{Name: "cp_task_id", Type: field.TypeInt64},
{Name: "cp_user_id", Type: field.TypeInt64},
{Name: "system_user_id", Type: field.TypeInt64},
}
// CpTaskLogsTable holds the schema information for the "cp_task_logs" table.
CpTaskLogsTable = &schema.Table{
Name: "cp_task_logs",
Columns: CpTaskLogsColumns,
PrimaryKey: []*schema.Column{CpTaskLogsColumns[0]},
ForeignKeys: []*schema.ForeignKey{
{
Symbol: "cp_task_logs_cp_tasks_cp_task_logs",
Columns: []*schema.Column{CpTaskLogsColumns[4]},
RefColumns: []*schema.Column{CpTasksColumns[0]},
OnDelete: schema.NoAction,
},
{
Symbol: "cp_task_logs_cp_users_cp_task_logs",
Columns: []*schema.Column{CpTaskLogsColumns[5]},
RefColumns: []*schema.Column{CpUsersColumns[0]},
OnDelete: schema.NoAction,
},
{
Symbol: "cp_task_logs_sys_user_cp_task_logs",
Columns: []*schema.Column{CpTaskLogsColumns[6]},
RefColumns: []*schema.Column{SysUserColumns[0]},
OnDelete: schema.NoAction,
},
},
}
// CpUsersColumns holds the columns for the "cp_users" table.
CpUsersColumns = []*schema.Column{
{Name: "id", Type: field.TypeInt64, Increment: true},
{Name: "username", Type: field.TypeString},
{Name: "password", Type: field.TypeString},
{Name: "email", Type: field.TypeString, Nullable: true},
{Name: "mobile_code", Type: field.TypeString, Nullable: true},
{Name: "cookie", Type: field.TypeString, Nullable: true, Size: 2147483647},
{Name: "mobile_type", Type: field.TypeEnum, Enums: []string{"random", "authorize"}},
{Name: "school_id", Type: field.TypeString},
{Name: "user_id", Type: field.TypeInt64},
}
// CpUsersTable holds the schema information for the "cp_users" table.
CpUsersTable = &schema.Table{
Name: "cp_users",
Columns: CpUsersColumns,
PrimaryKey: []*schema.Column{CpUsersColumns[0]},
ForeignKeys: []*schema.ForeignKey{
{
Symbol: "cp_users_cp_schools_cpusers",
Columns: []*schema.Column{CpUsersColumns[7]},
RefColumns: []*schema.Column{CpSchoolsColumns[0]},
OnDelete: schema.NoAction,
},
{
Symbol: "cp_users_sys_user_cpuser",
Columns: []*schema.Column{CpUsersColumns[8]},
RefColumns: []*schema.Column{SysUserColumns[0]},
OnDelete: schema.NoAction,
},
},
}
// SysAgentColumns holds the columns for the "sys_agent" table.
SysAgentColumns = []*schema.Column{
{Name: "id", Type: field.TypeInt64, Increment: true},
{Name: "create_time", Type: field.TypeString, SchemaType: map[string]string{"mysql": "datetime", "postgres": "timestamp", "sqlite3": "datetime"}},
{Name: "update_time", Type: field.TypeString, SchemaType: map[string]string{"mysql": "datetime", "postgres": "timestamp", "sqlite3": "datetime"}},
{Name: "level", Type: field.TypeInt},
{Name: "rate", Type: field.TypeString, SchemaType: map[string]string{"mysql": "decimal(10,2)", "postgres": "numeric(10,2)"}},
{Name: "sys_user_agent", Type: field.TypeInt64, Unique: true, Nullable: true},
}
// SysAgentTable holds the schema information for the "sys_agent" table.
SysAgentTable = &schema.Table{
Name: "sys_agent",
Columns: SysAgentColumns,
PrimaryKey: []*schema.Column{SysAgentColumns[0]},
ForeignKeys: []*schema.ForeignKey{
{
Symbol: "sys_agent_sys_user_agent",
Columns: []*schema.Column{SysAgentColumns[5]},
RefColumns: []*schema.Column{SysUserColumns[0]},
OnDelete: schema.SetNull,
},
},
}
// SysCardColumns holds the columns for the "sys_card" table.
SysCardColumns = []*schema.Column{
{Name: "id", Type: field.TypeInt64, Increment: true},
{Name: "create_time", Type: field.TypeString, SchemaType: map[string]string{"mysql": "datetime", "postgres": "timestamp", "sqlite3": "datetime"}},
{Name: "update_time", Type: field.TypeString, SchemaType: map[string]string{"mysql": "datetime", "postgres": "timestamp", "sqlite3": "datetime"}},
{Name: "content", Type: field.TypeString, Unique: true},
{Name: "status", Type: field.TypeEnum, Enums: []string{"enable", "used", "cashback", "disable"}},
{Name: "value", Type: field.TypeUint64},
{Name: "cash_value", Type: field.TypeString, SchemaType: map[string]string{"mysql": "decimal(10,2)", "postgres": "numeric(10,2)"}},
{Name: "creator_id", Type: field.TypeInt64},
{Name: "used_id", Type: field.TypeInt64, Nullable: true},
{Name: "cash_user_id", Type: field.TypeInt64, Nullable: true},
}
// SysCardTable holds the schema information for the "sys_card" table.
SysCardTable = &schema.Table{
Name: "sys_card",
Columns: SysCardColumns,
PrimaryKey: []*schema.Column{SysCardColumns[0]},
ForeignKeys: []*schema.ForeignKey{
{
Symbol: "sys_card_sys_user_created_cards",
Columns: []*schema.Column{SysCardColumns[7]},
RefColumns: []*schema.Column{SysUserColumns[0]},
OnDelete: schema.NoAction,
},
{
Symbol: "sys_card_sys_user_used_cards",
Columns: []*schema.Column{SysCardColumns[8]},
RefColumns: []*schema.Column{SysUserColumns[0]},
OnDelete: schema.SetNull,
},
{
Symbol: "sys_card_sys_user_cashback_cards",
Columns: []*schema.Column{SysCardColumns[9]},
RefColumns: []*schema.Column{SysUserColumns[0]},
OnDelete: schema.SetNull,
},
},
}
// SysMenuColumns holds the columns for the "sys_menu" table.
SysMenuColumns = []*schema.Column{
{Name: "id", Type: field.TypeInt64, Increment: true},
{Name: "create_time", Type: field.TypeString, SchemaType: map[string]string{"mysql": "datetime", "postgres": "timestamp", "sqlite3": "datetime"}},
{Name: "update_time", Type: field.TypeString, SchemaType: map[string]string{"mysql": "datetime", "postgres": "timestamp", "sqlite3": "datetime"}},
{Name: "name", Type: field.TypeString},
{Name: "label", Type: field.TypeString},
{Name: "type", Type: field.TypeEnum, Enums: []string{"group", "menu", "button", "link_in", "link_out"}},
{Name: "link", Type: field.TypeString, Nullable: true},
{Name: "permission", Type: field.TypeString},
{Name: "route", Type: field.TypeString, Nullable: true},
{Name: "component", Type: field.TypeString, Nullable: true},
{Name: "hidden", Type: field.TypeBool, Default: false},
{Name: "icon", Type: field.TypeString, Nullable: true},
{Name: "order", Type: field.TypeUint},
{Name: "sys_menu_children", Type: field.TypeInt64, Nullable: true},
}
// SysMenuTable holds the schema information for the "sys_menu" table.
SysMenuTable = &schema.Table{
Name: "sys_menu",
Columns: SysMenuColumns,
PrimaryKey: []*schema.Column{SysMenuColumns[0]},
ForeignKeys: []*schema.ForeignKey{
{
Symbol: "sys_menu_sys_menu_children",
Columns: []*schema.Column{SysMenuColumns[13]},
RefColumns: []*schema.Column{SysMenuColumns[0]},
OnDelete: schema.SetNull,
},
},
}
// SysRoleColumns holds the columns for the "sys_role" table.
SysRoleColumns = []*schema.Column{
{Name: "id", Type: field.TypeInt64, Increment: true},
{Name: "create_time", Type: field.TypeString, SchemaType: map[string]string{"mysql": "datetime", "postgres": "timestamp", "sqlite3": "datetime"}},
{Name: "update_time", Type: field.TypeString, SchemaType: map[string]string{"mysql": "datetime", "postgres": "timestamp", "sqlite3": "datetime"}},
{Name: "label", Type: field.TypeString, Unique: true},
{Name: "name", Type: field.TypeString, Unique: true},
{Name: "description", Type: field.TypeString},
{Name: "order", Type: field.TypeUint},
}
// SysRoleTable holds the schema information for the "sys_role" table.
SysRoleTable = &schema.Table{
Name: "sys_role",
Columns: SysRoleColumns,
PrimaryKey: []*schema.Column{SysRoleColumns[0]},
}
// SysUserColumns holds the columns for the "sys_user" table.
SysUserColumns = []*schema.Column{
{Name: "id", Type: field.TypeInt64, Increment: true},
{Name: "create_time", Type: field.TypeString, SchemaType: map[string]string{"mysql": "datetime", "postgres": "timestamp", "sqlite3": "datetime"}},
{Name: "update_time", Type: field.TypeString, SchemaType: map[string]string{"mysql": "datetime", "postgres": "timestamp", "sqlite3": "datetime"}},
{Name: "username", Type: field.TypeString, Unique: true},
{Name: "password", Type: field.TypeString},
{Name: "email", Type: field.TypeString, Unique: true},
{Name: "invite_code", Type: field.TypeString, Unique: true, Nullable: true},
{Name: "balance", Type: field.TypeString, SchemaType: map[string]string{"mysql": "decimal(10,2)", "postgres": "numeric(10,2)"}},
{Name: "block", Type: field.TypeBool, Default: false},
{Name: "verify", Type: field.TypeBool, Default: false},
{Name: "invite_cashback", Type: field.TypeString, SchemaType: map[string]string{"mysql": "decimal(10,2)", "postgres": "numeric(10,2)"}},
{Name: "sys_user_children", Type: field.TypeInt64, Nullable: true},
}
// SysUserTable holds the schema information for the "sys_user" table.
SysUserTable = &schema.Table{
Name: "sys_user",
Columns: SysUserColumns,
PrimaryKey: []*schema.Column{SysUserColumns[0]},
ForeignKeys: []*schema.ForeignKey{
{
Symbol: "sys_user_sys_user_children",
Columns: []*schema.Column{SysUserColumns[11]},
RefColumns: []*schema.Column{SysUserColumns[0]},
OnDelete: schema.SetNull,
},
},
}
// SysUserLogsColumns holds the columns for the "sys_user_logs" table.
SysUserLogsColumns = []*schema.Column{
{Name: "id", Type: field.TypeInt64, Increment: true},
}
// SysUserLogsTable holds the schema information for the "sys_user_logs" table.
SysUserLogsTable = &schema.Table{
Name: "sys_user_logs",
Columns: SysUserLogsColumns,
PrimaryKey: []*schema.Column{SysUserLogsColumns[0]},
}
// SysRoleMenusColumns holds the columns for the "sys_role_menus" table.
SysRoleMenusColumns = []*schema.Column{
{Name: "sys_role_id", Type: field.TypeInt},
{Name: "sys_menu_id", Type: field.TypeInt},
}
// SysRoleMenusTable holds the schema information for the "sys_role_menus" table.
SysRoleMenusTable = &schema.Table{
Name: "sys_role_menus",
Columns: SysRoleMenusColumns,
PrimaryKey: []*schema.Column{SysRoleMenusColumns[0], SysRoleMenusColumns[1]},
ForeignKeys: []*schema.ForeignKey{
{
Symbol: "sys_role_menus_sys_role_id",
Columns: []*schema.Column{SysRoleMenusColumns[0]},
RefColumns: []*schema.Column{SysRoleColumns[0]},
OnDelete: schema.Cascade,
},
{
Symbol: "sys_role_menus_sys_menu_id",
Columns: []*schema.Column{SysRoleMenusColumns[1]},
RefColumns: []*schema.Column{SysMenuColumns[0]},
OnDelete: schema.Cascade,
},
},
}
// SysUserRolesColumns holds the columns for the "sys_user_roles" table.
SysUserRolesColumns = []*schema.Column{
{Name: "sys_user_id", Type: field.TypeInt},
{Name: "sys_role_id", Type: field.TypeInt},
}
// SysUserRolesTable holds the schema information for the "sys_user_roles" table.
SysUserRolesTable = &schema.Table{
Name: "sys_user_roles",
Columns: SysUserRolesColumns,
PrimaryKey: []*schema.Column{SysUserRolesColumns[0], SysUserRolesColumns[1]},
ForeignKeys: []*schema.ForeignKey{
{
Symbol: "sys_user_roles_sys_user_id",
Columns: []*schema.Column{SysUserRolesColumns[0]},
RefColumns: []*schema.Column{SysUserColumns[0]},
OnDelete: schema.Cascade,
},
{
Symbol: "sys_user_roles_sys_role_id",
Columns: []*schema.Column{SysUserRolesColumns[1]},
RefColumns: []*schema.Column{SysRoleColumns[0]},
OnDelete: schema.Cascade,
},
},
}
// Tables holds all the tables in the schema.
Tables = []*schema.Table{
CpImageTable,
CpSchoolsTable,
CpTasksTable,
CpTaskLogsTable,
CpUsersTable,
SysAgentTable,
SysCardTable,
SysMenuTable,
SysRoleTable,
SysUserTable,
SysUserLogsTable,
SysRoleMenusTable,
SysUserRolesTable,
}
)
func init() {
CpImageTable.ForeignKeys[0].RefTable = SysUserTable
CpImageTable.Annotation = &entsql.Annotation{
Table: "cp_image",
IncrementStart: func(i int) *int { return &i }(0),
}
CpSchoolsTable.Annotation = &entsql.Annotation{
IncrementStart: func(i int) *int { return &i }(4294967296),
}
CpTasksTable.ForeignKeys[0].RefTable = CpUsersTable
CpTasksTable.ForeignKeys[1].RefTable = SysUserTable
CpTasksTable.Annotation = &entsql.Annotation{
IncrementStart: func(i int) *int { return &i }(8589934592),
}
CpTaskLogsTable.ForeignKeys[0].RefTable = CpTasksTable
CpTaskLogsTable.ForeignKeys[1].RefTable = CpUsersTable
CpTaskLogsTable.ForeignKeys[2].RefTable = SysUserTable
CpTaskLogsTable.Annotation = &entsql.Annotation{
IncrementStart: func(i int) *int { return &i }(12884901888),
}
CpUsersTable.ForeignKeys[0].RefTable = CpSchoolsTable
CpUsersTable.ForeignKeys[1].RefTable = SysUserTable
CpUsersTable.Annotation = &entsql.Annotation{
IncrementStart: func(i int) *int { return &i }(17179869184),
}
SysAgentTable.ForeignKeys[0].RefTable = SysUserTable
SysAgentTable.Annotation = &entsql.Annotation{
Table: "sys_agent",
IncrementStart: func(i int) *int { return &i }(21474836480),
}
SysCardTable.ForeignKeys[0].RefTable = SysUserTable
SysCardTable.ForeignKeys[1].RefTable = SysUserTable
SysCardTable.ForeignKeys[2].RefTable = SysUserTable
SysCardTable.Annotation = &entsql.Annotation{
Table: "sys_card",
IncrementStart: func(i int) *int { return &i }(25769803776),
}
SysMenuTable.ForeignKeys[0].RefTable = SysMenuTable
SysMenuTable.Annotation = &entsql.Annotation{
Table: "sys_menu",
IncrementStart: func(i int) *int { return &i }(30064771072),
}
SysRoleTable.Annotation = &entsql.Annotation{
Table: "sys_role",
IncrementStart: func(i int) *int { return &i }(34359738368),
}
SysUserTable.ForeignKeys[0].RefTable = SysUserTable
SysUserTable.Annotation = &entsql.Annotation{
Table: "sys_user",
IncrementStart: func(i int) *int { return &i }(38654705664),
}
SysUserLogsTable.Annotation = &entsql.Annotation{
IncrementStart: func(i int) *int { return &i }(42949672960),
}
SysRoleMenusTable.ForeignKeys[0].RefTable = SysRoleTable
SysRoleMenusTable.ForeignKeys[1].RefTable = SysMenuTable
SysUserRolesTable.ForeignKeys[0].RefTable = SysUserTable
SysUserRolesTable.ForeignKeys[1].RefTable = SysRoleTable
}