summaryrefslogtreecommitdiffstats
path: root/models/migrations/v1_19
diff options
context:
space:
mode:
authorJason Song <i@wolfogre.com>2022-11-24 10:49:41 +0800
committerGitHub <noreply@github.com>2022-11-23 20:49:41 -0600
commit702f4b521e118482e5887664efe69035fff96ceb (patch)
tree83f3026f5a3f3e169f3de7e03bad726638b6c11f /models/migrations/v1_19
parente483ec3a00752349dd4aa326ae75b2bbdd45981f (diff)
downloadgitea-702f4b521e118482e5887664efe69035fff96ceb.tar.gz
gitea-702f4b521e118482e5887664efe69035fff96ceb.zip
Add index for access_token (#21908)
The `token_last_eight` field has been used in `GetAccessTokenBySHA `:
Diffstat (limited to 'models/migrations/v1_19')
-rw-r--r--models/migrations/v1_19/v235.go17
1 files changed, 17 insertions, 0 deletions
diff --git a/models/migrations/v1_19/v235.go b/models/migrations/v1_19/v235.go
new file mode 100644
index 0000000000..b43ee32a56
--- /dev/null
+++ b/models/migrations/v1_19/v235.go
@@ -0,0 +1,17 @@
+// Copyright 2022 The Gitea Authors. All rights reserved.
+// Use of this source code is governed by a MIT-style
+// license that can be found in the LICENSE file.
+
+package v1_19 //nolint
+
+import (
+ "xorm.io/xorm"
+)
+
+func AddIndexForAccessToken(x *xorm.Engine) error {
+ type AccessToken struct {
+ TokenLastEight string `xorm:"INDEX token_last_eight"`
+ }
+
+ return x.Sync(new(AccessToken))
+}