code.gitea.io/gitea@v1.21.7/models/migrations/v1_16/v191.go (about) 1 // Copyright 2021 The Gitea Authors. All rights reserved. 2 // SPDX-License-Identifier: MIT 3 4 package v1_16 //nolint 5 6 import ( 7 "code.gitea.io/gitea/modules/setting" 8 9 "xorm.io/xorm" 10 ) 11 12 func AlterIssueAndCommentTextFieldsToLongText(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 `issue` CHANGE `content` `content` LONGTEXT"); err != nil { 21 return err 22 } 23 if _, err := sess.Exec("ALTER TABLE `comment` CHANGE `content` `content` LONGTEXT, CHANGE `patch` `patch` LONGTEXT"); err != nil { 24 return err 25 } 26 } 27 return sess.Commit() 28 }