Skip to content

Commit d86b8e1

Browse files
vizv6543
authored andcommitted
Allow more than 255 characters for tokens in external_login_user table (go-gitea#8554)
Signed-off-by: Wenxuan Zhao <viz@linux.com>
1 parent 4e85c8e commit d86b8e1

File tree

3 files changed

+24
-3
lines changed

3 files changed

+24
-3
lines changed

models/external_login_user.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,9 @@ type ExternalLoginUser struct {
2828
Description string
2929
AvatarURL string
3030
Location string
31-
AccessToken string
32-
AccessTokenSecret string
33-
RefreshToken string
31+
AccessToken string `xorm:"TEXT"`
32+
AccessTokenSecret string `xorm:"TEXT"`
33+
RefreshToken string `xorm:"TEXT"`
3434
ExpiresAt time.Time
3535
}
3636

models/migrations/migrations.go

+2
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,8 @@ var migrations = []Migration{
256256
NewMigration("add task table and status column for repository table", addTaskTable),
257257
// v100 -> v101
258258
NewMigration("update migration repositories' service type", updateMigrationServiceTypes),
259+
// v101 -> v102
260+
NewMigration("change length of some external login users columns", changeSomeColumnsLengthOfExternalLoginUser),
259261
}
260262

261263
// Migrate database to current version

models/migrations/v101.go

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
// Copyright 2019 The Gitea Authors. All rights reserved.
2+
// Use of this source code is governed by a MIT-style
3+
// license that can be found in the LICENSE file.
4+
5+
package migrations
6+
7+
import (
8+
"xorm.io/xorm"
9+
)
10+
11+
func changeSomeColumnsLengthOfExternalLoginUser(x *xorm.Engine) error {
12+
type ExternalLoginUser struct {
13+
AccessToken string `xorm:"TEXT"`
14+
AccessTokenSecret string `xorm:"TEXT"`
15+
RefreshToken string `xorm:"TEXT"`
16+
}
17+
18+
return x.Sync2(new(ExternalLoginUser))
19+
}

0 commit comments

Comments
 (0)