175 lines
8.0 KiB
Go
175 lines
8.0 KiB
Go
// 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 (
|
|
// UserColumns holds the columns for the "user" table.
|
|
UserColumns = []*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: "tenant_id", Type: field.TypeUint64, Comment: "Tenant ID | 租户 ID", Default: 1},
|
|
{Name: "deleted_at", Type: field.TypeTime, Nullable: true, Comment: "Delete Time | 删除日期"},
|
|
{Name: "username", Type: field.TypeString, Unique: true, Size: 50, Comment: "用户名"},
|
|
{Name: "email", Type: field.TypeString, Unique: true, Size: 255, Comment: "邮箱"},
|
|
{Name: "mobile", Type: field.TypeString, Nullable: true, Size: 64, Comment: "联系方式"},
|
|
{Name: "password_hash", Type: field.TypeString, Comment: "密码"},
|
|
{Name: "salt", Type: field.TypeString, Size: 255, Comment: "salt盐值"},
|
|
{Name: "nickname", Type: field.TypeString, Size: 50, Comment: "昵称", Default: ""},
|
|
{Name: "avatar", Type: field.TypeString, Nullable: true, Size: 500, Comment: "头像"},
|
|
{Name: "gender", Type: field.TypeEnum, Comment: "性别", Enums: []string{"unknown", "male", "female", "other"}, Default: "unknown"},
|
|
{Name: "birthday", Type: field.TypeTime, Nullable: true},
|
|
{Name: "account_status", Type: field.TypeEnum, Comment: "账户状态", Enums: []string{"unverified", "active", "locked", "disabled"}, Default: "unverified"},
|
|
{Name: "is_verified", Type: field.TypeUint32, Comment: "1 邮箱 ,2 电话号码", Default: 0},
|
|
{Name: "registered_login_ip", Type: field.TypeString, Nullable: true, Size: 255, Comment: "注册IP地址"},
|
|
{Name: "login_attempts", Type: field.TypeInt64, Comment: "登录尝试次数", Default: 0},
|
|
{Name: "metadata", Type: field.TypeJSON, Nullable: true},
|
|
{Name: "registration_source", Type: field.TypeString, Nullable: true, Size: 50, Comment: "注册来源"},
|
|
}
|
|
// UserTable holds the schema information for the "user" table.
|
|
UserTable = &schema.Table{
|
|
Name: "user",
|
|
Comment: "User Table | C端用户表",
|
|
Columns: UserColumns,
|
|
PrimaryKey: []*schema.Column{UserColumns[0]},
|
|
Indexes: []*schema.Index{
|
|
{
|
|
Name: "user_username",
|
|
Unique: true,
|
|
Columns: []*schema.Column{UserColumns[6]},
|
|
},
|
|
{
|
|
Name: "user_email",
|
|
Unique: true,
|
|
Columns: []*schema.Column{UserColumns[7]},
|
|
},
|
|
{
|
|
Name: "user_mobile",
|
|
Unique: true,
|
|
Columns: []*schema.Column{UserColumns[8]},
|
|
},
|
|
},
|
|
}
|
|
// UserLoginLogsColumns holds the columns for the "user_login_logs" table.
|
|
UserLoginLogsColumns = []*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: "tenant_id", Type: field.TypeUint64, Comment: "Tenant ID | 租户 ID", Default: 1},
|
|
{Name: "deleted_at", Type: field.TypeTime, Nullable: true, Comment: "Delete Time | 删除日期"},
|
|
{Name: "user_id", Type: field.TypeUint64, Comment: "用户ID"},
|
|
{Name: "login_time", Type: field.TypeTime},
|
|
{Name: "login_ip", Type: field.TypeString, Size: 45},
|
|
{Name: "login_location", Type: field.TypeString, Nullable: true, Size: 200},
|
|
{Name: "login_type", Type: field.TypeEnum, Enums: []string{"password", "sms_code", "email_code", "wechat", "alipay", "apple", "google", "other_third_party"}, Default: "password"},
|
|
{Name: "login_platform", Type: field.TypeEnum, Enums: []string{"ios", "android", "windows"}, Default: "android"},
|
|
{Name: "login_result", Type: field.TypeBool, Comment: "登录结果,是否成功", Default: true},
|
|
{Name: "failure_reason", Type: field.TypeString, Nullable: true, Size: 500},
|
|
{Name: "session_id", Type: field.TypeString, Nullable: true, Size: 200},
|
|
{Name: "latency_ms", Type: field.TypeInt, Nullable: true},
|
|
{Name: "auth_id", Type: field.TypeUint64, Nullable: true, Comment: "auth_id"},
|
|
{Name: "additional_data", Type: field.TypeJSON, Nullable: true},
|
|
}
|
|
// UserLoginLogsTable holds the schema information for the "user_login_logs" table.
|
|
UserLoginLogsTable = &schema.Table{
|
|
Name: "user_login_logs",
|
|
Comment: "user_login_logs Table | 用户登录信息表",
|
|
Columns: UserLoginLogsColumns,
|
|
PrimaryKey: []*schema.Column{UserLoginLogsColumns[0]},
|
|
Indexes: []*schema.Index{
|
|
{
|
|
Name: "userloginlog_user_id_login_time",
|
|
Unique: false,
|
|
Columns: []*schema.Column{UserLoginLogsColumns[6], UserLoginLogsColumns[7]},
|
|
},
|
|
{
|
|
Name: "userloginlog_login_time",
|
|
Unique: false,
|
|
Columns: []*schema.Column{UserLoginLogsColumns[7]},
|
|
},
|
|
{
|
|
Name: "userloginlog_login_ip",
|
|
Unique: false,
|
|
Columns: []*schema.Column{UserLoginLogsColumns[8]},
|
|
},
|
|
{
|
|
Name: "userloginlog_login_type",
|
|
Unique: false,
|
|
Columns: []*schema.Column{UserLoginLogsColumns[10]},
|
|
},
|
|
{
|
|
Name: "userloginlog_login_platform",
|
|
Unique: false,
|
|
Columns: []*schema.Column{UserLoginLogsColumns[11]},
|
|
},
|
|
{
|
|
Name: "userloginlog_login_result",
|
|
Unique: false,
|
|
Columns: []*schema.Column{UserLoginLogsColumns[12]},
|
|
},
|
|
{
|
|
Name: "userloginlog_session_id",
|
|
Unique: false,
|
|
Columns: []*schema.Column{UserLoginLogsColumns[14]},
|
|
},
|
|
},
|
|
}
|
|
// UserThirdAuthsColumns holds the columns for the "user_third_auths" table.
|
|
UserThirdAuthsColumns = []*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: "tenant_id", Type: field.TypeUint64, Comment: "Tenant ID | 租户 ID", Default: 1},
|
|
{Name: "deleted_at", Type: field.TypeTime, Nullable: true, Comment: "Delete Time | 删除日期"},
|
|
{Name: "user_id", Type: field.TypeUint64, Comment: "用户ID"},
|
|
{Name: "openid", Type: field.TypeString, Nullable: true, Size: 255},
|
|
{Name: "unionid", Type: field.TypeString, Nullable: true, Size: 255},
|
|
{Name: "access_token", Type: field.TypeString, Nullable: true, Size: 2000},
|
|
{Name: "refresh_token", Type: field.TypeString, Nullable: true, Size: 2000},
|
|
{Name: "access_token_expiry", Type: field.TypeTime, Nullable: true},
|
|
{Name: "user_info", Type: field.TypeJSON, Nullable: true},
|
|
{Name: "platform_user_id", Type: field.TypeString, Nullable: true, Size: 255},
|
|
{Name: "nickname", Type: field.TypeString, Nullable: true, Size: 100},
|
|
{Name: "avatar", Type: field.TypeString, Nullable: true, Size: 500},
|
|
{Name: "email", Type: field.TypeString, Nullable: true, Size: 255},
|
|
{Name: "mobile", Type: field.TypeString, Nullable: true, Size: 20},
|
|
{Name: "is_bound", Type: field.TypeBool, Default: true},
|
|
{Name: "bound_at", Type: field.TypeTime},
|
|
{Name: "extra_data", Type: field.TypeJSON, Nullable: true},
|
|
}
|
|
// UserThirdAuthsTable holds the schema information for the "user_third_auths" table.
|
|
UserThirdAuthsTable = &schema.Table{
|
|
Name: "user_third_auths",
|
|
Comment: "user_third_auths Table | 用户token表",
|
|
Columns: UserThirdAuthsColumns,
|
|
PrimaryKey: []*schema.Column{UserThirdAuthsColumns[0]},
|
|
}
|
|
// Tables holds all the tables in the schema.
|
|
Tables = []*schema.Table{
|
|
UserTable,
|
|
UserLoginLogsTable,
|
|
UserThirdAuthsTable,
|
|
}
|
|
)
|
|
|
|
func init() {
|
|
UserTable.Annotation = &entsql.Annotation{
|
|
Table: "user",
|
|
}
|
|
UserLoginLogsTable.Annotation = &entsql.Annotation{
|
|
Table: "user_login_logs",
|
|
}
|
|
UserThirdAuthsTable.Annotation = &entsql.Annotation{
|
|
Table: "user_third_auths",
|
|
}
|
|
}
|