mirror of
https://github.com/woodchen-ink/aimodels-prices.git
synced 2025-07-18 13:41:59 +08:00
优化用户模型 Email 字段长度限制
- 为 Email 字段添加 varchar(191) 类型约束 - 确保数据库兼容性和索引性能
This commit is contained in:
parent
aeb05f790a
commit
31f65a9301
@ -9,7 +9,7 @@ import (
|
|||||||
type User struct {
|
type User struct {
|
||||||
ID uint `json:"id" gorm:"primaryKey"`
|
ID uint `json:"id" gorm:"primaryKey"`
|
||||||
Username string `json:"username" gorm:"not null;unique"`
|
Username string `json:"username" gorm:"not null;unique"`
|
||||||
Email string `json:"email" gorm:"not null"`
|
Email string `json:"email" gorm:"not null;type:varchar(191)"`
|
||||||
Role string `json:"role" gorm:"not null;default:user"` // admin or user
|
Role string `json:"role" gorm:"not null;default:user"` // admin or user
|
||||||
CreatedAt time.Time `json:"created_at" gorm:"autoCreateTime"`
|
CreatedAt time.Time `json:"created_at" gorm:"autoCreateTime"`
|
||||||
UpdatedAt time.Time `json:"updated_at" gorm:"autoUpdateTime"`
|
UpdatedAt time.Time `json:"updated_at" gorm:"autoUpdateTime"`
|
||||||
|
Loading…
x
Reference in New Issue
Block a user