Skip to content

Commit e52e605

Browse files
ashimokawa6543
authored andcommitted
CB/revert: Do not use longtext but stay with text like gitea 1.15 for issues and comments
This disables migration v191 and prevents v198 from adding a longtext column XORM struts are also reverted to TEXT to prevent warnings during starup
1 parent 1611c8f commit e52e605

File tree

6 files changed

+7
-23
lines changed

6 files changed

+7
-23
lines changed

models/issues/comment.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -252,12 +252,12 @@ type Comment struct {
252252
CommitID int64
253253
Line int64 // - previous line / + proposed line
254254
TreePath string
255-
Content string `xorm:"LONGTEXT"`
255+
Content string `xorm:"TEXT"`
256256
RenderedContent string `xorm:"-"`
257257

258258
// Path represents the 4 lines of code cemented by this comment
259259
Patch string `xorm:"-"`
260-
PatchQuoted string `xorm:"LONGTEXT patch"`
260+
PatchQuoted string `xorm:"TEXT patch"`
261261

262262
CreatedUnix timeutil.TimeStamp `xorm:"INDEX created"`
263263
UpdatedUnix timeutil.TimeStamp `xorm:"INDEX updated"`

models/issues/content_history.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ type ContentHistory struct {
2323
IssueID int64 `xorm:"INDEX"`
2424
CommentID int64 `xorm:"INDEX"`
2525
EditedUnix timeutil.TimeStamp `xorm:"INDEX"`
26-
ContentText string `xorm:"LONGTEXT"`
26+
ContentText string `xorm:"TEXT"`
2727
IsFirstCreated bool
2828
IsDeleted bool
2929
}

models/issues/issue.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ type Issue struct {
112112
OriginalAuthor string
113113
OriginalAuthorID int64 `xorm:"index"`
114114
Title string `xorm:"name"`
115-
Content string `xorm:"LONGTEXT"`
115+
Content string `xorm:"TEXT"`
116116
RenderedContent string `xorm:"-"`
117117
Labels []*Label `xorm:"-"`
118118
MilestoneID int64 `xorm:"INDEX"`

models/migrations/migrations.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -335,7 +335,7 @@ var migrations = []Migration{
335335
// v190 -> v191
336336
NewMigration("Add agit flow pull request support", addAgitFlowPullRequest),
337337
// v191 -> v192
338-
NewMigration("Alter issue/comment table TEXT fields to LONGTEXT", alterIssueAndCommentTextFieldsToLongText),
338+
NewMigration("Alter issue/comment table TEXT fields to LONGTEXT (nop)", alterIssueAndCommentTextFieldsToLongText),
339339
// v192 -> v193
340340
NewMigration("RecreateIssueResourceIndexTable to have a primary key instead of an unique index", recreateIssueResourceIndexTable),
341341
// v193 -> v194

models/migrations/v191.go

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -5,25 +5,9 @@
55
package migrations
66

77
import (
8-
"code.gitea.io/gitea/modules/setting"
9-
108
"xorm.io/xorm"
119
)
1210

1311
func alterIssueAndCommentTextFieldsToLongText(x *xorm.Engine) error {
14-
sess := x.NewSession()
15-
defer sess.Close()
16-
if err := sess.Begin(); err != nil {
17-
return err
18-
}
19-
20-
if setting.Database.UseMySQL {
21-
if _, err := sess.Exec("ALTER TABLE `issue` CHANGE `content` `content` LONGTEXT"); err != nil {
22-
return err
23-
}
24-
if _, err := sess.Exec("ALTER TABLE `comment` CHANGE `content` `content` LONGTEXT, CHANGE `patch` `patch` LONGTEXT"); err != nil {
25-
return err
26-
}
27-
}
28-
return sess.Commit()
12+
return nil
2913
}

models/migrations/v198.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ func addTableIssueContentHistory(x *xorm.Engine) error {
1919
IssueID int64 `xorm:"INDEX"`
2020
CommentID int64 `xorm:"INDEX"`
2121
EditedUnix timeutil.TimeStamp `xorm:"INDEX"`
22-
ContentText string `xorm:"LONGTEXT"`
22+
ContentText string `xorm:"TEXT"`
2323
IsFirstCreated bool
2424
IsDeleted bool
2525
}

0 commit comments

Comments
 (0)