mirror of
https://github.com/go-gitea/gitea.git
synced 2026-10-03 08:45:33 +02:00
Fix merge conflig in migrations.go Merge remote-tracking branch 'upstream/main' into limit-repo-size
This commit is contained in:
commit
bcea146ed2
103 files changed
+1747
-640
No files matched your search
@@ -451,6 +451,8 @@ var migrations = []Migration{
|
||||
NewMigration("Drop ForeignReference table", v1_19.DropForeignReferenceTable),
|
||||
// v238 -> v239
|
||||
NewMigration("Add updated unix to LFSMetaObject", v1_19.AddUpdatedUnixToLFSMetaObject),
|
||||
// v239 -> v240
|
||||
NewMigration("Add scope for access_token", v1_19.AddScopeForAccessTokens),
|
||||
// to modify later
|
||||
NewMigration("add size limit on repository", v1_19.AddSizeLimitOnRepo),
|
||||
}
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
// Copyright 2022 The Gitea Authors. All rights reserved.
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
package v1_19 //nolint
|
||||
|
||||
import (
|
||||
"xorm.io/xorm"
|
||||
)
|
||||
|
||||
func AddScopeForAccessTokens(x *xorm.Engine) error {
|
||||
type AccessToken struct {
|
||||
Scope string
|
||||
}
|
||||
|
||||
if err := x.Sync(new(AccessToken)); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// all previous tokens have `all` and `sudo` scopes
|
||||
_, err := x.Exec("UPDATE access_token SET scope = ? WHERE scope IS NULL OR scope = ''", "all,sudo")
|
||||
return err
|
||||
}
|
||||
Reference in new issue
Block a user