Skip to content

Commit cd201b9

Browse files
ashimokawaCodeberg Admins @ build
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 605381e commit cd201b9

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
@@ -258,12 +258,12 @@ type Comment struct {
258258
CommitID int64
259259
Line int64 // - previous line / + proposed line
260260
TreePath string
261-
Content string `xorm:"LONGTEXT"`
261+
Content string `xorm:"TEXT"`
262262
RenderedContent string `xorm:"-"`
263263

264264
// Path represents the 4 lines of code cemented by this comment
265265
Patch string `xorm:"-"`
266-
PatchQuoted string `xorm:"LONGTEXT patch"`
266+
PatchQuoted string `xorm:"TEXT patch"`
267267

268268
CreatedUnix timeutil.TimeStamp `xorm:"INDEX created"`
269269
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
@@ -24,7 +24,7 @@ type ContentHistory struct {
2424
IssueID int64 `xorm:"INDEX"`
2525
CommentID int64 `xorm:"INDEX"`
2626
EditedUnix timeutil.TimeStamp `xorm:"INDEX"`
27-
ContentText string `xorm:"LONGTEXT"`
27+
ContentText string `xorm:"TEXT"`
2828
IsFirstCreated bool
2929
IsDeleted bool
3030
}

models/issues/issue.go

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

models/migrations/migrations.go

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