0
0
Fork 0
mirror of https://github.com/go-gitea/gitea synced 2024-11-17 23:41:49 +01:00
gitea/models/migrations/v179.go

28 lines
704 B
Go
Raw Normal View History

// 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,
},
Nullable: true,
DefaultIsEmpty: true,
})
}