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