2021-04-14 14:02:12 +02:00
|
|
|
// Copyright 2021 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 (
|
|
|
|
"xorm.io/xorm"
|
|
|
|
"xorm.io/xorm/schemas"
|
|
|
|
)
|
|
|
|
|
|
|
|
func convertAvatarURLToText(x *xorm.Engine) error {
|
|
|
|
dbType := x.Dialect().URI().DBType
|
|
|
|
if dbType == schemas.SQLITE { // For SQLITE, varchar or char will always be represented as TEXT
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
// Some oauth2 providers may give very long avatar urls (i.e. Google)
|
|
|
|
return modifyColumn(x, "external_login_user", &schemas.Column{
|
|
|
|
Name: "avatar_url",
|
|
|
|
SQLType: schemas.SQLType{
|
|
|
|
Name: schemas.Text,
|
|
|
|
},
|
2022-06-04 21:18:50 +02:00
|
|
|
Nullable: true,
|
|
|
|
DefaultIsEmpty: true,
|
2021-04-14 14:02:12 +02:00
|
|
|
})
|
|
|
|
}
|