File tree Expand file tree Collapse file tree 3 files changed +39
-1
lines changed Expand file tree Collapse file tree 3 files changed +39
-1
lines changed Original file line number Diff line number Diff line change @@ -274,6 +274,8 @@ var migrations = []Migration{
274274 NewMigration ("Add comment_id on table notification" , addCommentIDOnNotification ),
275275 // v109 -> v110
276276 NewMigration ("add can_create_org_repo to team" , addCanCreateOrgRepoColumnForTeam ),
277+ // v110 -> v111
278+ NewMigration ("change review content type to text" , changeReviewContentToText ),
277279}
278280
279281// Migrate database to current version
Original file line number Diff line number Diff line change 1+ // Copyright 2019 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+ "xorm.io/core"
9+ "xorm.io/xorm"
10+ )
11+
12+ func changeReviewContentToText (x * xorm.Engine ) error {
13+
14+ if x .Dialect ().DBType () == core .MYSQL {
15+ _ , err := x .Exec ("ALTER TABLE review MODIFY COLUMN content TEXT" )
16+ return err
17+ }
18+
19+ if x .Dialect ().DBType () == core .ORACLE {
20+ _ , err := x .Exec ("ALTER TABLE review MODIFY content TEXT" )
21+ return err
22+ }
23+
24+ if x .Dialect ().DBType () == core .MSSQL {
25+ _ , err := x .Exec ("ALTER TABLE review ALTER COLUMN content TEXT" )
26+ return err
27+ }
28+
29+ if x .Dialect ().DBType () == core .POSTGRES {
30+ _ , err := x .Exec ("ALTER TABLE review ALTER COLUMN content TYPE TEXT" )
31+ return err
32+ }
33+
34+ // SQLite doesn't support ALTER COLUMN, and it seem to already make String to _TEXT_ default so no migration needed
35+ return nil
36+ }
Original file line number Diff line number Diff line change @@ -52,7 +52,7 @@ type Review struct {
5252 ReviewerID int64 `xorm:"index"`
5353 Issue * Issue `xorm:"-"`
5454 IssueID int64 `xorm:"index"`
55- Content string
55+ Content string `xorm:"TEXT"`
5656
5757 CreatedUnix timeutil.TimeStamp `xorm:"INDEX created"`
5858 UpdatedUnix timeutil.TimeStamp `xorm:"INDEX updated"`
You can’t perform that action at this time.
0 commit comments