2021-08-22 11:33:05 -04:00
|
|
|
// Copyright 2021 The Gitea Authors. All rights reserved.
|
2022-11-27 13:20:29 -05:00
|
|
|
// SPDX-License-Identifier: MIT
|
2021-08-22 11:33:05 -04:00
|
|
|
|
2022-11-02 04:54:36 -04:00
|
|
|
package v1_16 //nolint
|
2021-08-22 11:33:05 -04:00
|
|
|
|
|
|
|
import (
|
|
|
|
"code.gitea.io/gitea/modules/setting"
|
2021-11-17 07:34:35 -05:00
|
|
|
|
2021-08-22 11:33:05 -04:00
|
|
|
"xorm.io/xorm"
|
|
|
|
)
|
|
|
|
|
2022-11-02 04:54:36 -04:00
|
|
|
func AlterIssueAndCommentTextFieldsToLongText(x *xorm.Engine) error {
|
2021-08-22 11:33:05 -04:00
|
|
|
sess := x.NewSession()
|
|
|
|
defer sess.Close()
|
|
|
|
if err := sess.Begin(); err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
2023-03-07 05:51:06 -05:00
|
|
|
if setting.Database.Type.IsMySQL() {
|
2021-08-22 11:33:05 -04:00
|
|
|
if _, err := sess.Exec("ALTER TABLE `issue` CHANGE `content` `content` LONGTEXT"); err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
if _, err := sess.Exec("ALTER TABLE `comment` CHANGE `content` `content` LONGTEXT, CHANGE `patch` `patch` LONGTEXT"); err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return sess.Commit()
|
|
|
|
}
|