diff --git a/models/auth/auth_token.go b/models/auth/auth_token.go index 8955b57a4f..c64af3e41f 100644 --- a/models/auth/auth_token.go +++ b/models/auth/auth_token.go @@ -39,7 +39,7 @@ type AuthorizationToken struct { UID int64 `xorm:"INDEX"` LookupKey string `xorm:"INDEX UNIQUE"` HashedValidator string - Purpose AuthorizationPurpose `xorm:"NOT NULL"` + Purpose AuthorizationPurpose `xorm:"NOT NULL DEFAULT 'long_term_authorization'"` Expiry timeutil.TimeStamp } diff --git a/models/forgejo_migrations/v24.go b/models/forgejo_migrations/v24.go index 8c751e3f5f..ebfb5fc1c4 100644 --- a/models/forgejo_migrations/v24.go +++ b/models/forgejo_migrations/v24.go @@ -8,7 +8,7 @@ import "xorm.io/xorm" func AddPurposeToForgejoAuthToken(x *xorm.Engine) error { type ForgejoAuthToken struct { ID int64 `xorm:"pk autoincr"` - Purpose string `xorm:"NOT NULL"` + Purpose string `xorm:"NOT NULL DEFAULT 'long_term_authorization'"` } if err := x.Sync(new(ForgejoAuthToken)); err != nil { return err