mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-12-22 23:33:15 -05:00
20 lines
520 B
Go
20 lines
520 B
Go
|
// Copyright 2024 The Forgejo Authors. All rights reserved.
|
||
|
// SPDX-License-Identifier: MIT
|
||
|
|
||
|
package forgejo_migrations //nolint:revive
|
||
|
|
||
|
import "xorm.io/xorm"
|
||
|
|
||
|
func AddPurposeToForgejoAuthToken(x *xorm.Engine) error {
|
||
|
type ForgejoAuthToken struct {
|
||
|
ID int64 `xorm:"pk autoincr"`
|
||
|
Purpose string `xorm:"NOT NULL"`
|
||
|
}
|
||
|
if err := x.Sync(new(ForgejoAuthToken)); err != nil {
|
||
|
return err
|
||
|
}
|
||
|
|
||
|
_, err := x.Exec("UPDATE `forgejo_auth_token` SET purpose = 'long_term_authorization' WHERE purpose = ''")
|
||
|
return err
|
||
|
}
|