Skip to content

Commit b0c45fe

Browse files
committed
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 68d8731 commit b0c45fe

File tree

6 files changed

+7
-23
lines changed

6 files changed

+7
-23
lines changed

models/issue.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ type Issue struct {
4242
OriginalAuthor string
4343
OriginalAuthorID int64 `xorm:"index"`
4444
Title string `xorm:"name"`
45-
Content string `xorm:"LONGTEXT"`
45+
Content string `xorm:"TEXT"`
4646
RenderedContent string `xorm:"-"`
4747
Labels []*Label `xorm:"-"`
4848
MilestoneID int64 `xorm:"INDEX"`

models/issue_comment.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -228,12 +228,12 @@ type Comment struct {
228228
CommitID int64
229229
Line int64 // - previous line / + proposed line
230230
TreePath string
231-
Content string `xorm:"LONGTEXT"`
231+
Content string `xorm:"TEXT"`
232232
RenderedContent string `xorm:"-"`
233233

234234
// Path represents the 4 lines of code cemented by this comment
235235
Patch string `xorm:"-"`
236-
PatchQuoted string `xorm:"LONGTEXT patch"`
236+
PatchQuoted string `xorm:"TEXT patch"`
237237

238238
CreatedUnix timeutil.TimeStamp `xorm:"INDEX created"`
239239
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/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,26 +5,10 @@
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 {
1412

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

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)