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