fix: 移除 SQLite 不支持的 CURRENT_TIMESTAMP 列默认值,修复迁移失败 crash loop
This commit is contained in:
1 parent
0c0c56b18e
commit
06a9dac99b
1 file changed
+4
-3
@@ -16,11 +16,12 @@ type User struct {
|
||||
Role string `json:"role" gorm:"size:20;default:'admin'"` // 固定 admin,预留扩展
|
||||
IsActive bool `json:"is_active" gorm:"default:true"`
|
||||
LastLogin *time.Time `json:"last_login,omitempty"`
|
||||
// 会话失效基线:签发时间早于该值的 JWT 一律拒绝(改密码时刷新为当前时间) // Logan.Li
|
||||
TokenValidAfter time.Time `json:"-" gorm:"default:CURRENT_TIMESTAMP"`
|
||||
// 会话失效基线:签发时间早于该值的 JWT 一律拒绝(改密码时刷新为当前时间)。
|
||||
// 零值表示未设置过,不拦截旧令牌;SQLite 不允许 ADD COLUMN 带非常量默认值,故不用 DEFAULT CURRENT_TIMESTAMP // Logan.Li
|
||||
TokenValidAfter time.Time `json:"-"`
|
||||
// 账号级登录防护:连续失败计数与锁定截止时间 // Logan.Li
|
||||
FailedLoginAttempts int `json:"-" gorm:"default:0"`
|
||||
LockedUntil *time.Time `json:"-" gorm:"default:null"`
|
||||
LockedUntil *time.Time `json:"-"`
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
UpdatedAt time.Time `json:"updated_at"`
|
||||
DeletedAt gorm.DeletedAt `json:"deleted_at,omitempty" gorm:"index"`
|
||||
|
||||
Reference in new issue
Block a user