Skip to content

Commit

Permalink
Allow more than 255 characters for tokens in external_login_user tabl… (
Browse files Browse the repository at this point in the history
#8585)

* Allow more than 255 characters for tokens in external_login_user table (#8554)

Signed-off-by: Wenxuan Zhao <[email protected]>

* use old xorm repo
  • Loading branch information
6543 authored and lunny committed Oct 19, 2019
1 parent 4e85c8e commit 7565ac0
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 3 deletions.
6 changes: 3 additions & 3 deletions models/external_login_user.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ type ExternalLoginUser struct {
Description string
AvatarURL string
Location string
AccessToken string
AccessTokenSecret string
RefreshToken string
AccessToken string `xorm:"TEXT"`
AccessTokenSecret string `xorm:"TEXT"`
RefreshToken string `xorm:"TEXT"`
ExpiresAt time.Time
}

Expand Down
2 changes: 2 additions & 0 deletions models/migrations/migrations.go
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,8 @@ var migrations = []Migration{
NewMigration("add task table and status column for repository table", addTaskTable),
// v100 -> v101
NewMigration("update migration repositories' service type", updateMigrationServiceTypes),
// v101 -> v102
NewMigration("change length of some external login users columns", changeSomeColumnsLengthOfExternalLoginUser),
}

// Migrate database to current version
Expand Down
19 changes: 19 additions & 0 deletions models/migrations/v101.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// Copyright 2019 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 migrations

import (
"github.com/go-xorm/xorm"
)

func changeSomeColumnsLengthOfExternalLoginUser(x *xorm.Engine) error {
type ExternalLoginUser struct {
AccessToken string `xorm:"TEXT"`
AccessTokenSecret string `xorm:"TEXT"`
RefreshToken string `xorm:"TEXT"`
}

return x.Sync2(new(ExternalLoginUser))
}

0 comments on commit 7565ac0

Please sign in to comment.