File tree 4 files changed +37
-3
lines changed
4 files changed +37
-3
lines changed Original file line number Diff line number Diff line change @@ -36,7 +36,7 @@ type Issue struct {
36
36
OriginalAuthor string
37
37
OriginalAuthorID int64 `xorm:"index"`
38
38
Title string `xorm:"name"`
39
- Content string `xorm:"TEXT "`
39
+ Content string `xorm:"LONGTEXT "`
40
40
RenderedContent string `xorm:"-"`
41
41
Labels []* Label `xorm:"-"`
42
42
MilestoneID int64 `xorm:"INDEX"`
Original file line number Diff line number Diff line change @@ -155,12 +155,12 @@ type Comment struct {
155
155
CommitID int64
156
156
Line int64 // - previous line / + proposed line
157
157
TreePath string
158
- Content string `xorm:"TEXT "`
158
+ Content string `xorm:"LONGTEXT "`
159
159
RenderedContent string `xorm:"-"`
160
160
161
161
// Path represents the 4 lines of code cemented by this comment
162
162
Patch string `xorm:"-"`
163
- PatchQuoted string `xorm:"TEXT patch"`
163
+ PatchQuoted string `xorm:"LONGTEXT patch"`
164
164
165
165
CreatedUnix timeutil.TimeStamp `xorm:"INDEX created"`
166
166
UpdatedUnix timeutil.TimeStamp `xorm:"INDEX updated"`
Original file line number Diff line number Diff line change @@ -334,6 +334,8 @@ var migrations = []Migration{
334
334
NewMigration ("Unwrap ldap.Sources" , unwrapLDAPSourceCfg ),
335
335
// v190 -> v191
336
336
NewMigration ("Add agit flow pull request support" , addAgitFlowPullRequest ),
337
+ // v191 -> v192
338
+ NewMigration ("Alter issue/comment table TEXT fields to LONGTEXT" , alterIssueAndCommentTextFieldsToLongText ),
337
339
}
338
340
339
341
// GetCurrentDBVersion returns the current db version
Original file line number Diff line number Diff line change
1
+ // Copyright 2021 The Gitea Authors. All rights reserved.
2
+ // Use of this source code is governed by a MIT-style
3
+ // license that can be found in the LICENSE file.
4
+
5
+ package migrations
6
+
7
+ import (
8
+ "code.gitea.io/gitea/modules/setting"
9
+ "xorm.io/xorm"
10
+ )
11
+
12
+ func alterIssueAndCommentTextFieldsToLongText (x * xorm.Engine ) error {
13
+
14
+ sess := x .NewSession ()
15
+ defer sess .Close ()
16
+ if err := sess .Begin (); err != nil {
17
+ return err
18
+ }
19
+
20
+ switch {
21
+ case 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
+ default :
29
+ // only MySQL needs to widen the TEXT limitation. pgsql/mssql/sqlite do not have such limitation.
30
+ }
31
+ return sess .Commit ()
32
+ }
You can’t perform that action at this time.
0 commit comments