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