|
|
// 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 (
|
|
|
// SysDepartmentColumns holds the columns for the "sys_department" table.
|
|
|
SysDepartmentColumns = []*schema.Column{
|
|
|
{Name: "id", Type: field.TypeInt64, Comment: "Primary Key | 主键"},
|
|
|
{Name: "created_at", Type: field.TypeTime, Comment: "Create Time | 创建时间", SchemaType: map[string]string{"mysql": "datetime"}},
|
|
|
{Name: "updated_at", Type: field.TypeTime, Comment: "Update Time | 更新时间", SchemaType: map[string]string{"mysql": "datetime"}},
|
|
|
{Name: "status", Type: field.TypeEnum, Comment: "Status | 状态", Enums: []string{"Normal", "Pending", "Disabled", "Locked"}, Default: "Normal", SchemaType: map[string]string{"mysql": "varchar(32)"}},
|
|
|
{Name: "version", Type: field.TypeInt64, Comment: "optimistic lock | 乐观锁", Default: 1},
|
|
|
{Name: "name", Type: field.TypeString, Comment: "Department name | 部门名称"},
|
|
|
{Name: "remark", Type: field.TypeString, Nullable: true, Comment: "Remark | 备注"},
|
|
|
{Name: "parent_id", Type: field.TypeInt64, Nullable: true, Comment: "Parent ID | 直接父级ID"},
|
|
|
{Name: "leader_id", Type: field.TypeInt64, Nullable: true, Comment: "Department leader | 部门负责人"},
|
|
|
}
|
|
|
// SysDepartmentTable holds the schema information for the "sys_department" table.
|
|
|
SysDepartmentTable = &schema.Table{
|
|
|
Name: "sys_department",
|
|
|
Comment: "系统部门表",
|
|
|
Columns: SysDepartmentColumns,
|
|
|
PrimaryKey: []*schema.Column{SysDepartmentColumns[0]},
|
|
|
ForeignKeys: []*schema.ForeignKey{
|
|
|
{
|
|
|
Symbol: "sys_department_sys_department_children",
|
|
|
Columns: []*schema.Column{SysDepartmentColumns[7]},
|
|
|
RefColumns: []*schema.Column{SysDepartmentColumns[0]},
|
|
|
OnDelete: schema.SetNull,
|
|
|
},
|
|
|
{
|
|
|
Symbol: "sys_department_sys_user_leader",
|
|
|
Columns: []*schema.Column{SysDepartmentColumns[8]},
|
|
|
RefColumns: []*schema.Column{SysUserColumns[0]},
|
|
|
OnDelete: schema.SetNull,
|
|
|
},
|
|
|
},
|
|
|
}
|
|
|
// SysDictionaryColumns holds the columns for the "sys_dictionary" table.
|
|
|
SysDictionaryColumns = []*schema.Column{
|
|
|
{Name: "id", Type: field.TypeInt64, Comment: "Primary Key | 主键"},
|
|
|
{Name: "created_at", Type: field.TypeTime, Comment: "Create Time | 创建时间", SchemaType: map[string]string{"mysql": "datetime"}},
|
|
|
{Name: "updated_at", Type: field.TypeTime, Comment: "Update Time | 更新时间", SchemaType: map[string]string{"mysql": "datetime"}},
|
|
|
{Name: "status", Type: field.TypeEnum, Comment: "Status | 状态", Enums: []string{"Normal", "Pending", "Disabled", "Locked"}, Default: "Normal", SchemaType: map[string]string{"mysql": "varchar(32)"}},
|
|
|
{Name: "version", Type: field.TypeInt64, Comment: "optimistic lock | 乐观锁", Default: 1},
|
|
|
{Name: "title", Type: field.TypeString, Comment: "The title shown in the ui | 展示名称 (建议配合i18n)"},
|
|
|
{Name: "name", Type: field.TypeString, Unique: true, Comment: "The name of dictionary for search | 字典搜索名称"},
|
|
|
{Name: "description", Type: field.TypeString, Nullable: true, Comment: "The description of dictionary | 字典的描述"},
|
|
|
}
|
|
|
// SysDictionaryTable holds the schema information for the "sys_dictionary" table.
|
|
|
SysDictionaryTable = &schema.Table{
|
|
|
Name: "sys_dictionary",
|
|
|
Comment: "字典表",
|
|
|
Columns: SysDictionaryColumns,
|
|
|
PrimaryKey: []*schema.Column{SysDictionaryColumns[0]},
|
|
|
}
|
|
|
// SysDictionaryDetailsColumns holds the columns for the "sys_dictionary_details" table.
|
|
|
SysDictionaryDetailsColumns = []*schema.Column{
|
|
|
{Name: "id", Type: field.TypeInt64, Comment: "Primary Key | 主键"},
|
|
|
{Name: "created_at", Type: field.TypeTime, Comment: "Create Time | 创建时间", SchemaType: map[string]string{"mysql": "datetime"}},
|
|
|
{Name: "updated_at", Type: field.TypeTime, Comment: "Update Time | 更新时间", SchemaType: map[string]string{"mysql": "datetime"}},
|
|
|
{Name: "status", Type: field.TypeEnum, Comment: "Status | 状态", Enums: []string{"Normal", "Pending", "Disabled", "Locked"}, Default: "Normal", SchemaType: map[string]string{"mysql": "varchar(32)"}},
|
|
|
{Name: "sort", Type: field.TypeUint32, Comment: "Sort number | 排序号", Default: 1},
|
|
|
{Name: "version", Type: field.TypeInt64, Comment: "optimistic lock | 乐观锁", Default: 1},
|
|
|
{Name: "title", Type: field.TypeString, Comment: "The title shown in the ui | 展示名称 (建议配合i18n)"},
|
|
|
{Name: "key", Type: field.TypeString, Comment: "key | 键"},
|
|
|
{Name: "value", Type: field.TypeString, Comment: "value | 值"},
|
|
|
{Name: "dictionary_id", Type: field.TypeInt64, Comment: "Dictionary ID | 字典ID"},
|
|
|
}
|
|
|
// SysDictionaryDetailsTable holds the schema information for the "sys_dictionary_details" table.
|
|
|
SysDictionaryDetailsTable = &schema.Table{
|
|
|
Name: "sys_dictionary_details",
|
|
|
Comment: "字典详情表",
|
|
|
Columns: SysDictionaryDetailsColumns,
|
|
|
PrimaryKey: []*schema.Column{SysDictionaryDetailsColumns[0]},
|
|
|
ForeignKeys: []*schema.ForeignKey{
|
|
|
{
|
|
|
Symbol: "sys_dictionary_details_sys_dictionary_details",
|
|
|
Columns: []*schema.Column{SysDictionaryDetailsColumns[9]},
|
|
|
RefColumns: []*schema.Column{SysDictionaryColumns[0]},
|
|
|
OnDelete: schema.Cascade,
|
|
|
},
|
|
|
},
|
|
|
Indexes: []*schema.Index{
|
|
|
{
|
|
|
Name: "dictionarydetail_dictionary_id_key",
|
|
|
Unique: true,
|
|
|
Columns: []*schema.Column{SysDictionaryDetailsColumns[9], SysDictionaryDetailsColumns[7]},
|
|
|
},
|
|
|
{
|
|
|
Name: "dictionarydetail_key",
|
|
|
Unique: false,
|
|
|
Columns: []*schema.Column{SysDictionaryDetailsColumns[7]},
|
|
|
},
|
|
|
{
|
|
|
Name: "dictionarydetail_title",
|
|
|
Unique: false,
|
|
|
Columns: []*schema.Column{SysDictionaryDetailsColumns[6]},
|
|
|
},
|
|
|
},
|
|
|
}
|
|
|
// SysDistrictColumns holds the columns for the "sys_district" table.
|
|
|
SysDistrictColumns = []*schema.Column{
|
|
|
{Name: "id", Type: field.TypeInt64, Comment: "ID | 主键"},
|
|
|
{Name: "created_at", Type: field.TypeTime, Comment: "Create Time | 创建时间", SchemaType: map[string]string{"mysql": "datetime"}},
|
|
|
{Name: "updated_at", Type: field.TypeTime, Comment: "Update Time | 更新时间", SchemaType: map[string]string{"mysql": "datetime"}},
|
|
|
{Name: "name", Type: field.TypeString, Comment: "Region Name | 地区名称"},
|
|
|
{Name: "short_name", Type: field.TypeString, Nullable: true, Comment: "Region ShortName | 地区缩写,省级"},
|
|
|
{Name: "code", Type: field.TypeString, Unique: true, Comment: "Region Code | 地区行政编号"},
|
|
|
{Name: "province", Type: field.TypeString, Comment: "Province Code | 省级行政编号,表示该地区归属", Default: ""},
|
|
|
{Name: "city", Type: field.TypeString, Nullable: true, Comment: "City Code | 地级行政编号,表示该地区归属"},
|
|
|
{Name: "area", Type: field.TypeString, Nullable: true, Comment: "Area Code | 县级行政编号,表示该地区归属"},
|
|
|
{Name: "street", Type: field.TypeString, Nullable: true, Comment: "Street Code | 乡级行政编号,表示该地区归属"},
|
|
|
{Name: "level", Type: field.TypeUint32, Comment: "Region Level | 地区级别 1-省、自治区、直辖市 2-地级市、地区、自治州、盟 3-市辖区、县级市、县 4-乡镇", Default: 1},
|
|
|
{Name: "latitude", Type: field.TypeFloat64, Comment: "Latitude | 纬度", Default: 0},
|
|
|
{Name: "longitude", Type: field.TypeFloat64, Comment: "Longitude | 经度", Default: 0},
|
|
|
}
|
|
|
// SysDistrictTable holds the schema information for the "sys_district" table.
|
|
|
SysDistrictTable = &schema.Table{
|
|
|
Name: "sys_district",
|
|
|
Comment: "系统地区表(中国)",
|
|
|
Columns: SysDistrictColumns,
|
|
|
PrimaryKey: []*schema.Column{SysDistrictColumns[0]},
|
|
|
}
|
|
|
// SysLoginRecordColumns holds the columns for the "sys_login_record" table.
|
|
|
SysLoginRecordColumns = []*schema.Column{
|
|
|
{Name: "id", Type: field.TypeInt64, Comment: "Primary Key | 主键"},
|
|
|
{Name: "created_at", Type: field.TypeTime, Comment: "Create Time | 创建时间", SchemaType: map[string]string{"mysql": "datetime"}},
|
|
|
{Name: "updated_at", Type: field.TypeTime, Comment: "Update Time | 更新时间", SchemaType: map[string]string{"mysql": "datetime"}},
|
|
|
{Name: "version", Type: field.TypeInt64, Comment: "optimistic lock | 乐观锁", Default: 1},
|
|
|
{Name: "last_login_at", Type: field.TypeTime, Nullable: true, Comment: "LastLogin Time | 最近一次登录时间", SchemaType: map[string]string{"mysql": "datetime"}},
|
|
|
{Name: "last_login_ipv4", Type: field.TypeString, Nullable: true, Comment: "LastLogin IPv4 | 最近一次登录IPv4"},
|
|
|
{Name: "last_login_device", Type: field.TypeString, Nullable: true, Comment: "LastLogin Device | 最近一次登录设备"},
|
|
|
{Name: "last_login_ua", Type: field.TypeString, Nullable: true, Comment: "LastLogin UA | 最近一次登录浏览器UA", SchemaType: map[string]string{"mysql": "varchar(1024)"}},
|
|
|
{Name: "login_count", Type: field.TypeUint64, Comment: "Login Count | 总登录次数", Default: 1},
|
|
|
{Name: "user_id", Type: field.TypeInt64, Unique: true, Comment: "User ID | 用户ID"},
|
|
|
}
|
|
|
// SysLoginRecordTable holds the schema information for the "sys_login_record" table.
|
|
|
SysLoginRecordTable = &schema.Table{
|
|
|
Name: "sys_login_record",
|
|
|
Comment: "系统用户登录记录表",
|
|
|
Columns: SysLoginRecordColumns,
|
|
|
PrimaryKey: []*schema.Column{SysLoginRecordColumns[0]},
|
|
|
ForeignKeys: []*schema.ForeignKey{
|
|
|
{
|
|
|
Symbol: "sys_login_record_sys_user_loginRecord",
|
|
|
Columns: []*schema.Column{SysLoginRecordColumns[9]},
|
|
|
RefColumns: []*schema.Column{SysUserColumns[0]},
|
|
|
OnDelete: schema.Cascade,
|
|
|
},
|
|
|
},
|
|
|
}
|
|
|
// SysOauthProviderColumns holds the columns for the "sys_oauth_provider" table.
|
|
|
SysOauthProviderColumns = []*schema.Column{
|
|
|
{Name: "id", Type: field.TypeInt64, Comment: "Primary Key | 主键"},
|
|
|
{Name: "created_at", Type: field.TypeTime, Comment: "Create Time | 创建时间", SchemaType: map[string]string{"mysql": "datetime"}},
|
|
|
{Name: "updated_at", Type: field.TypeTime, Comment: "Update Time | 更新时间", SchemaType: map[string]string{"mysql": "datetime"}},
|
|
|
{Name: "deleted_at", Type: field.TypeTime, Nullable: true, Comment: "Soft delete | 软删除(逻辑删除)", SchemaType: map[string]string{"mysql": "datetime"}},
|
|
|
{Name: "name", Type: field.TypeString, Unique: true, Comment: "The provider's name | 提供商名称"},
|
|
|
{Name: "client_id", Type: field.TypeString, Comment: "The client id | 客户端 id"},
|
|
|
{Name: "client_secret", Type: field.TypeString, Comment: "The client secret | 客户端密钥"},
|
|
|
{Name: "redirect_url", Type: field.TypeString, Comment: "The redirect url | 跳转地址", Default: ""},
|
|
|
{Name: "scopes", Type: field.TypeString, Comment: "The scopes | 权限范围", Default: ""},
|
|
|
{Name: "auth_url", Type: field.TypeString, Comment: "The auth url of the provider | 认证地址", Default: ""},
|
|
|
{Name: "token_url", Type: field.TypeString, Comment: "The token url of the provider | 获取 Token 地址", Default: ""},
|
|
|
{Name: "info_url", Type: field.TypeString, Comment: "The URL to request user information by token | 用户信息请求地址", Default: ""},
|
|
|
{Name: "description", Type: field.TypeString, Size: 2147483647, Comment: "The description of the provider | 提供商描述", Default: ""},
|
|
|
{Name: "system", Type: field.TypeBool, Comment: "The system internal oauth provider | 系统内置提供商", Default: false},
|
|
|
{Name: "init", Type: field.TypeBool, Comment: "The oauth provider init status | 提供商初始化状态", Default: false},
|
|
|
}
|
|
|
// SysOauthProviderTable holds the schema information for the "sys_oauth_provider" table.
|
|
|
SysOauthProviderTable = &schema.Table{
|
|
|
Name: "sys_oauth_provider",
|
|
|
Comment: "OAuth提供商",
|
|
|
Columns: SysOauthProviderColumns,
|
|
|
PrimaryKey: []*schema.Column{SysOauthProviderColumns[0]},
|
|
|
}
|
|
|
// SysRoleColumns holds the columns for the "sys_role" table.
|
|
|
SysRoleColumns = []*schema.Column{
|
|
|
{Name: "id", Type: field.TypeInt64, Comment: "Primary Key | 主键"},
|
|
|
{Name: "created_at", Type: field.TypeTime, Comment: "Create Time | 创建时间", SchemaType: map[string]string{"mysql": "datetime"}},
|
|
|
{Name: "updated_at", Type: field.TypeTime, Comment: "Update Time | 更新时间", SchemaType: map[string]string{"mysql": "datetime"}},
|
|
|
{Name: "version", Type: field.TypeInt64, Comment: "optimistic lock | 乐观锁", Default: 1},
|
|
|
{Name: "status", Type: field.TypeEnum, Comment: "Status | 状态", Enums: []string{"Normal", "Pending", "Disabled", "Locked"}, Default: "Normal", SchemaType: map[string]string{"mysql": "varchar(32)"}},
|
|
|
{Name: "deleted_at", Type: field.TypeTime, Nullable: true, Comment: "Soft delete | 软删除(逻辑删除)", SchemaType: map[string]string{"mysql": "datetime"}},
|
|
|
{Name: "code", Type: field.TypeString, Unique: true, Comment: "Role Code | 角色编码,可用于权限控制"},
|
|
|
{Name: "name", Type: field.TypeString, Comment: "Role Name | 角色名"},
|
|
|
{Name: "description", Type: field.TypeString, Comment: "Description | 角色描述"},
|
|
|
}
|
|
|
// SysRoleTable holds the schema information for the "sys_role" table.
|
|
|
SysRoleTable = &schema.Table{
|
|
|
Name: "sys_role",
|
|
|
Comment: "系统角色表",
|
|
|
Columns: SysRoleColumns,
|
|
|
PrimaryKey: []*schema.Column{SysRoleColumns[0]},
|
|
|
}
|
|
|
// SysTokenColumns holds the columns for the "sys_token" table.
|
|
|
SysTokenColumns = []*schema.Column{
|
|
|
{Name: "id", Type: field.TypeInt64, Comment: "Primary Key | 主键"},
|
|
|
{Name: "created_at", Type: field.TypeTime, Comment: "Create Time | 创建时间", SchemaType: map[string]string{"mysql": "datetime"}},
|
|
|
{Name: "updated_at", Type: field.TypeTime, Comment: "Update Time | 更新时间", SchemaType: map[string]string{"mysql": "datetime"}},
|
|
|
{Name: "status", Type: field.TypeEnum, Comment: "Status | 状态", Enums: []string{"Normal", "Pending", "Disabled", "Locked"}, Default: "Normal", SchemaType: map[string]string{"mysql": "varchar(32)"}},
|
|
|
{Name: "version", Type: field.TypeInt64, Comment: "optimistic lock | 乐观锁", Default: 1},
|
|
|
{Name: "token_type", Type: field.TypeString, Comment: "Token type | 凭证类型 [Bearer]"},
|
|
|
{Name: "access_token", Type: field.TypeString, Comment: "AccessToken | AccessToken 字符串"},
|
|
|
{Name: "refresh_token", Type: field.TypeString, Comment: "RefreshToken | RefreshToken 字符串"},
|
|
|
{Name: "source", Type: field.TypeString, Comment: "Source | Token来源,PCWeb/WechatMini/AlipayMini"},
|
|
|
{Name: "expired_at", Type: field.TypeTime, Comment: "Expire Time | 过期时间", SchemaType: map[string]string{"mysql": "datetime"}},
|
|
|
{Name: "user_id", Type: field.TypeInt64, Comment: "User's ID | 用户ID"},
|
|
|
}
|
|
|
// SysTokenTable holds the schema information for the "sys_token" table.
|
|
|
SysTokenTable = &schema.Table{
|
|
|
Name: "sys_token",
|
|
|
Comment: "Token表",
|
|
|
Columns: SysTokenColumns,
|
|
|
PrimaryKey: []*schema.Column{SysTokenColumns[0]},
|
|
|
ForeignKeys: []*schema.ForeignKey{
|
|
|
{
|
|
|
Symbol: "sys_token_sys_user_token",
|
|
|
Columns: []*schema.Column{SysTokenColumns[10]},
|
|
|
RefColumns: []*schema.Column{SysUserColumns[0]},
|
|
|
OnDelete: schema.Cascade,
|
|
|
},
|
|
|
},
|
|
|
}
|
|
|
// SysUserColumns holds the columns for the "sys_user" table.
|
|
|
SysUserColumns = []*schema.Column{
|
|
|
{Name: "id", Type: field.TypeInt64, Comment: "Primary Key | 主键"},
|
|
|
{Name: "status", Type: field.TypeEnum, Comment: "Status | 状态", Enums: []string{"Normal", "Pending", "Disabled", "Locked"}, Default: "Normal", SchemaType: map[string]string{"mysql": "varchar(32)"}},
|
|
|
{Name: "created_at", Type: field.TypeTime, Comment: "Create Time | 创建时间", SchemaType: map[string]string{"mysql": "datetime"}},
|
|
|
{Name: "updated_at", Type: field.TypeTime, Comment: "Update Time | 更新时间", SchemaType: map[string]string{"mysql": "datetime"}},
|
|
|
{Name: "version", Type: field.TypeInt64, Comment: "optimistic lock | 乐观锁", Default: 1},
|
|
|
{Name: "username", Type: field.TypeString, Unique: true, Comment: "User's login name | 登录名"},
|
|
|
{Name: "phone_number", Type: field.TypeString, Unique: true, Nullable: true, Comment: "Phone number | 手机号"},
|
|
|
{Name: "email", Type: field.TypeString, Unique: true, Nullable: true, Comment: "Email | 邮箱号"},
|
|
|
{Name: "password", Type: field.TypeString, Comment: "Password | 密码"},
|
|
|
{Name: "nickname", Type: field.TypeString, Unique: true, Nullable: true, Comment: "Nickname | 昵称"},
|
|
|
}
|
|
|
// SysUserTable holds the schema information for the "sys_user" table.
|
|
|
SysUserTable = &schema.Table{
|
|
|
Name: "sys_user",
|
|
|
Comment: "系统用户表",
|
|
|
Columns: SysUserColumns,
|
|
|
PrimaryKey: []*schema.Column{SysUserColumns[0]},
|
|
|
}
|
|
|
// SysUsermetaColumns holds the columns for the "sys_usermeta" table.
|
|
|
SysUsermetaColumns = []*schema.Column{
|
|
|
{Name: "id", Type: field.TypeInt64, Comment: "Primary Key | 主键"},
|
|
|
{Name: "created_at", Type: field.TypeTime, Comment: "Create Time | 创建时间", SchemaType: map[string]string{"mysql": "datetime"}},
|
|
|
{Name: "updated_at", Type: field.TypeTime, Comment: "Update Time | 更新时间", SchemaType: map[string]string{"mysql": "datetime"}},
|
|
|
{Name: "version", Type: field.TypeInt64, Comment: "optimistic lock | 乐观锁", Default: 1},
|
|
|
{Name: "key", Type: field.TypeString, Nullable: true, Comment: "Key | 键", SchemaType: map[string]string{"mysql": "varchar(255)"}},
|
|
|
{Name: "value", Type: field.TypeString, Nullable: true, Size: 2147483647, Comment: "Key | 值"},
|
|
|
{Name: "user_id", Type: field.TypeInt64, Comment: "User id | 用户ID"},
|
|
|
}
|
|
|
// SysUsermetaTable holds the schema information for the "sys_usermeta" table.
|
|
|
SysUsermetaTable = &schema.Table{
|
|
|
Name: "sys_usermeta",
|
|
|
Comment: "系统用户元数据表",
|
|
|
Columns: SysUsermetaColumns,
|
|
|
PrimaryKey: []*schema.Column{SysUsermetaColumns[0]},
|
|
|
ForeignKeys: []*schema.ForeignKey{
|
|
|
{
|
|
|
Symbol: "sys_usermeta_sys_user_metas",
|
|
|
Columns: []*schema.Column{SysUsermetaColumns[6]},
|
|
|
RefColumns: []*schema.Column{SysUserColumns[0]},
|
|
|
OnDelete: schema.Cascade,
|
|
|
},
|
|
|
},
|
|
|
Indexes: []*schema.Index{
|
|
|
{
|
|
|
Name: "usermeta_key",
|
|
|
Unique: false,
|
|
|
Columns: []*schema.Column{SysUsermetaColumns[4]},
|
|
|
},
|
|
|
{
|
|
|
Name: "usermeta_user_id",
|
|
|
Unique: false,
|
|
|
Columns: []*schema.Column{SysUsermetaColumns[6]},
|
|
|
},
|
|
|
{
|
|
|
Name: "usermeta_user_id_key",
|
|
|
Unique: true,
|
|
|
Columns: []*schema.Column{SysUsermetaColumns[6], SysUsermetaColumns[4]},
|
|
|
},
|
|
|
},
|
|
|
}
|
|
|
// SysUserSocialColumns holds the columns for the "sys_user_social" table.
|
|
|
SysUserSocialColumns = []*schema.Column{
|
|
|
{Name: "id", Type: field.TypeInt64, Comment: "Primary Key | 主键"},
|
|
|
{Name: "created_at", Type: field.TypeTime, Comment: "Create Time | 创建时间", SchemaType: map[string]string{"mysql": "datetime"}},
|
|
|
{Name: "updated_at", Type: field.TypeTime, Comment: "Update Time | 更新时间", SchemaType: map[string]string{"mysql": "datetime"}},
|
|
|
{Name: "provider", Type: field.TypeString, Comment: "OAuth Provider | 服务提供商"},
|
|
|
{Name: "access_token", Type: field.TypeString, Comment: "Access Token | 用户在提供商最近一次登录的访问凭证"},
|
|
|
{Name: "refresh_token", Type: field.TypeString, Comment: "Refresh Token | 用户在提供商最近一次登录的刷新凭证"},
|
|
|
{Name: "uid", Type: field.TypeString, Comment: "User's ID | 提供商用户ID,不一定存在"},
|
|
|
{Name: "open_id", Type: field.TypeString, Comment: "OpenID | 用户在提供商的OpenID"},
|
|
|
{Name: "union_id", Type: field.TypeString, Comment: "UnionID | 用户在提供商的UnionID"},
|
|
|
{Name: "key", Type: field.TypeString, Comment: "Key | 用户在提供商的用于解密的key"},
|
|
|
{Name: "expires_in", Type: field.TypeUint64, Comment: "Expires in | 访问凭证过期时长,单位:秒"},
|
|
|
{Name: "user_profile", Type: field.TypeString, Size: 2147483647, Comment: "User Profile | 提供商用户信息,不一定存在", SchemaType: map[string]string{"mysql": "json"}},
|
|
|
{Name: "user_id", Type: field.TypeInt64, Comment: "系统用户ID"},
|
|
|
}
|
|
|
// SysUserSocialTable holds the schema information for the "sys_user_social" table.
|
|
|
SysUserSocialTable = &schema.Table{
|
|
|
Name: "sys_user_social",
|
|
|
Comment: "用户社交信息表",
|
|
|
Columns: SysUserSocialColumns,
|
|
|
PrimaryKey: []*schema.Column{SysUserSocialColumns[0]},
|
|
|
ForeignKeys: []*schema.ForeignKey{
|
|
|
{
|
|
|
Symbol: "sys_user_social_sys_user_socials",
|
|
|
Columns: []*schema.Column{SysUserSocialColumns[12]},
|
|
|
RefColumns: []*schema.Column{SysUserColumns[0]},
|
|
|
OnDelete: schema.Cascade,
|
|
|
},
|
|
|
},
|
|
|
}
|
|
|
// UserRolesColumns holds the columns for the "user_roles" table.
|
|
|
UserRolesColumns = []*schema.Column{
|
|
|
{Name: "user_id", Type: field.TypeInt64},
|
|
|
{Name: "role_id", Type: field.TypeInt64},
|
|
|
}
|
|
|
// UserRolesTable holds the schema information for the "user_roles" table.
|
|
|
UserRolesTable = &schema.Table{
|
|
|
Name: "user_roles",
|
|
|
Columns: UserRolesColumns,
|
|
|
PrimaryKey: []*schema.Column{UserRolesColumns[0], UserRolesColumns[1]},
|
|
|
ForeignKeys: []*schema.ForeignKey{
|
|
|
{
|
|
|
Symbol: "user_roles_user_id",
|
|
|
Columns: []*schema.Column{UserRolesColumns[0]},
|
|
|
RefColumns: []*schema.Column{SysUserColumns[0]},
|
|
|
OnDelete: schema.Cascade,
|
|
|
},
|
|
|
{
|
|
|
Symbol: "user_roles_role_id",
|
|
|
Columns: []*schema.Column{UserRolesColumns[1]},
|
|
|
RefColumns: []*schema.Column{SysRoleColumns[0]},
|
|
|
OnDelete: schema.Cascade,
|
|
|
},
|
|
|
},
|
|
|
}
|
|
|
// UserDepartmentsColumns holds the columns for the "user_departments" table.
|
|
|
UserDepartmentsColumns = []*schema.Column{
|
|
|
{Name: "user_id", Type: field.TypeInt64},
|
|
|
{Name: "department_id", Type: field.TypeInt64},
|
|
|
}
|
|
|
// UserDepartmentsTable holds the schema information for the "user_departments" table.
|
|
|
UserDepartmentsTable = &schema.Table{
|
|
|
Name: "user_departments",
|
|
|
Columns: UserDepartmentsColumns,
|
|
|
PrimaryKey: []*schema.Column{UserDepartmentsColumns[0], UserDepartmentsColumns[1]},
|
|
|
ForeignKeys: []*schema.ForeignKey{
|
|
|
{
|
|
|
Symbol: "user_departments_user_id",
|
|
|
Columns: []*schema.Column{UserDepartmentsColumns[0]},
|
|
|
RefColumns: []*schema.Column{SysUserColumns[0]},
|
|
|
OnDelete: schema.Cascade,
|
|
|
},
|
|
|
{
|
|
|
Symbol: "user_departments_department_id",
|
|
|
Columns: []*schema.Column{UserDepartmentsColumns[1]},
|
|
|
RefColumns: []*schema.Column{SysDepartmentColumns[0]},
|
|
|
OnDelete: schema.Cascade,
|
|
|
},
|
|
|
},
|
|
|
}
|
|
|
// Tables holds all the tables in the schema.
|
|
|
Tables = []*schema.Table{
|
|
|
SysDepartmentTable,
|
|
|
SysDictionaryTable,
|
|
|
SysDictionaryDetailsTable,
|
|
|
SysDistrictTable,
|
|
|
SysLoginRecordTable,
|
|
|
SysOauthProviderTable,
|
|
|
SysRoleTable,
|
|
|
SysTokenTable,
|
|
|
SysUserTable,
|
|
|
SysUsermetaTable,
|
|
|
SysUserSocialTable,
|
|
|
UserRolesTable,
|
|
|
UserDepartmentsTable,
|
|
|
}
|
|
|
)
|
|
|
|
|
|
func init() {
|
|
|
SysDepartmentTable.ForeignKeys[0].RefTable = SysDepartmentTable
|
|
|
SysDepartmentTable.ForeignKeys[1].RefTable = SysUserTable
|
|
|
SysDepartmentTable.Annotation = &entsql.Annotation{
|
|
|
Table: "sys_department",
|
|
|
}
|
|
|
SysDictionaryTable.Annotation = &entsql.Annotation{
|
|
|
Table: "sys_dictionary",
|
|
|
}
|
|
|
SysDictionaryDetailsTable.ForeignKeys[0].RefTable = SysDictionaryTable
|
|
|
SysDictionaryDetailsTable.Annotation = &entsql.Annotation{
|
|
|
Table: "sys_dictionary_details",
|
|
|
}
|
|
|
SysDistrictTable.Annotation = &entsql.Annotation{
|
|
|
Table: "sys_district",
|
|
|
}
|
|
|
SysLoginRecordTable.ForeignKeys[0].RefTable = SysUserTable
|
|
|
SysLoginRecordTable.Annotation = &entsql.Annotation{
|
|
|
Table: "sys_login_record",
|
|
|
}
|
|
|
SysOauthProviderTable.Annotation = &entsql.Annotation{
|
|
|
Table: "sys_oauth_provider",
|
|
|
}
|
|
|
SysRoleTable.Annotation = &entsql.Annotation{
|
|
|
Table: "sys_role",
|
|
|
}
|
|
|
SysTokenTable.ForeignKeys[0].RefTable = SysUserTable
|
|
|
SysTokenTable.Annotation = &entsql.Annotation{
|
|
|
Table: "sys_token",
|
|
|
}
|
|
|
SysUserTable.Annotation = &entsql.Annotation{
|
|
|
Table: "sys_user",
|
|
|
}
|
|
|
SysUsermetaTable.ForeignKeys[0].RefTable = SysUserTable
|
|
|
SysUsermetaTable.Annotation = &entsql.Annotation{
|
|
|
Table: "sys_usermeta",
|
|
|
}
|
|
|
SysUserSocialTable.ForeignKeys[0].RefTable = SysUserTable
|
|
|
SysUserSocialTable.Annotation = &entsql.Annotation{
|
|
|
Table: "sys_user_social",
|
|
|
}
|
|
|
UserRolesTable.ForeignKeys[0].RefTable = SysUserTable
|
|
|
UserRolesTable.ForeignKeys[1].RefTable = SysRoleTable
|
|
|
UserDepartmentsTable.ForeignKeys[0].RefTable = SysUserTable
|
|
|
UserDepartmentsTable.ForeignKeys[1].RefTable = SysDepartmentTable
|
|
|
}
|