2021-08-22 09:33:05 -06:00
|
|
|
// Copyright 2021 The Gitea Authors. All rights reserved.
|
2022-11-27 11:20:29 -07:00
|
|
|
// SPDX-License-Identifier: MIT
|
2021-08-22 09:33:05 -06:00
|
|
|
|
2022-11-02 02:54:36 -06:00
|
|
|
package v1_16 //nolint
|
2021-08-22 09:33:05 -06:00
|
|
|
|
|
|
|
import (
|
|
|
|
"code.gitea.io/gitea/modules/setting"
|
2021-11-17 05:34:35 -07:00
|
|
|
|
2021-08-22 09:33:05 -06:00
|
|
|
"xorm.io/xorm"
|
|
|
|
)
|
|
|
|
|
2022-11-02 02:54:36 -06:00
|
|
|
func AlterIssueAndCommentTextFieldsToLongText(x *xorm.Engine) error {
|
2021-08-22 09:33:05 -06:00
|
|
|
sess := x.NewSession()
|
|
|
|
defer sess.Close()
|
|
|
|
if err := sess.Begin(); err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
2023-03-07 03:51:06 -07:00
|
|
|
if setting.Database.Type.IsMySQL() {
|
2021-08-22 09:33:05 -06: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()
|
|
|
|
}
|