code.gitea.io/gitea@v1.21.7/models/migrations/v1_18/v225.go (about) 1 // Copyright 2022 The Gitea Authors. All rights reserved. 2 // SPDX-License-Identifier: MIT 3 4 package v1_18 //nolint 5 6 import ( 7 "code.gitea.io/gitea/modules/setting" 8 9 "xorm.io/xorm" 10 ) 11 12 func AlterPublicGPGKeyContentFieldsToMediumText(x *xorm.Engine) error { 13 sess := x.NewSession() 14 defer sess.Close() 15 if err := sess.Begin(); err != nil { 16 return err 17 } 18 19 if setting.Database.Type.IsMySQL() { 20 if _, err := sess.Exec("ALTER TABLE `gpg_key` CHANGE `content` `content` MEDIUMTEXT"); err != nil { 21 return err 22 } 23 if _, err := sess.Exec("ALTER TABLE `public_key` CHANGE `content` `content` MEDIUMTEXT"); err != nil { 24 return err 25 } 26 } 27 return sess.Commit() 28 }