diff --git a/models/migrations/migrations.go b/models/migrations/migrations.go index 578cbca035d85..7136222139e02 100644 --- a/models/migrations/migrations.go +++ b/models/migrations/migrations.go @@ -552,6 +552,8 @@ var migrations = []Migration{ NewMigration("Add Index to pull_auto_merge.doer_id", v1_22.AddIndexToPullAutoMergeDoerID), // v283 -> v284 NewMigration("Add combined Index to issue_user.uid and issue_id", v1_22.AddCombinedIndexToIssueUser), + // v284 -> v285 + NewMigration("Incrase external_login_user.provider size to 255", v1_22.UpdateExternalLoginUserProvider), } // GetCurrentDBVersion returns the current db version diff --git a/models/migrations/v1_22/v284.go b/models/migrations/v1_22/v284.go new file mode 100644 index 0000000000000..8d9d6745ec7a3 --- /dev/null +++ b/models/migrations/v1_22/v284.go @@ -0,0 +1,16 @@ +// Copyright 2023 The Gitea Authors. All rights reserved. +// SPDX-License-Identifier: MIT + +package v1_22 //nolint + +import ( + "xorm.io/xorm" +) + +func UpdateExternalLoginUserProvider(x *xorm.Engine) error { + type ExternalLoginUser struct { + Provider string `xorm:"index VARCHAR(255)"` + } + + return x.Sync(new(ExternalLoginUser)) +} diff --git a/models/user/external_login_user.go b/models/user/external_login_user.go index 965b7a5ed1dfd..43fe850ef2ded 100644 --- a/models/user/external_login_user.go +++ b/models/user/external_login_user.go @@ -61,7 +61,7 @@ type ExternalLoginUser struct { UserID int64 `xorm:"INDEX NOT NULL"` LoginSourceID int64 `xorm:"pk NOT NULL"` RawData map[string]any `xorm:"TEXT JSON"` - Provider string `xorm:"index VARCHAR(25)"` + Provider string `xorm:"index VARCHAR(255)"` Email string Name string FirstName string diff --git a/services/forms/auth_form.go b/services/forms/auth_form.go index 25acbbb99e877..8f4198d393fd4 100644 --- a/services/forms/auth_form.go +++ b/services/forms/auth_form.go @@ -16,7 +16,7 @@ import ( type AuthenticationForm struct { ID int64 Type int `binding:"Range(2,7)"` - Name string `binding:"Required;MaxSize(30)"` + Name string `binding:"Required;MaxSize(255)"` Host string Port int BindDN string