diff options
Diffstat (limited to 'models/migrations')
-rw-r--r-- | models/migrations/migrations.go | 2 | ||||
-rw-r--r-- | models/migrations/v198.go | 33 |
2 files changed, 35 insertions, 0 deletions
diff --git a/models/migrations/migrations.go b/models/migrations/migrations.go index 6f6296dabf..ef0c071417 100644 --- a/models/migrations/migrations.go +++ b/models/migrations/migrations.go @@ -348,6 +348,8 @@ var migrations = []Migration{ NewMigration("Add Color to ProjectBoard table", addColorColToProjectBoard), // v197 -> v198 NewMigration("Add renamed_branch table", addRenamedBranchTable), + // v198 -> v199 + NewMigration("Add issue content history table", addTableIssueContentHistory), } // GetCurrentDBVersion returns the current db version diff --git a/models/migrations/v198.go b/models/migrations/v198.go new file mode 100644 index 0000000000..e3c31460a9 --- /dev/null +++ b/models/migrations/v198.go @@ -0,0 +1,33 @@ +// Copyright 2021 The Gitea Authors. All rights reserved. +// Use of this source code is governed by a MIT-style +// license that can be found in the LICENSE file. + +package migrations + +import ( + "fmt" + + "code.gitea.io/gitea/modules/timeutil" + + "xorm.io/xorm" +) + +func addTableIssueContentHistory(x *xorm.Engine) error { + type IssueContentHistory struct { + ID int64 `xorm:"pk autoincr"` + PosterID int64 + IssueID int64 `xorm:"INDEX"` + CommentID int64 `xorm:"INDEX"` + EditedUnix timeutil.TimeStamp `xorm:"INDEX"` + ContentText string `xorm:"LONGTEXT"` + IsFirstCreated bool + IsDeleted bool + } + + sess := x.NewSession() + defer sess.Close() + if err := sess.Sync2(new(IssueContentHistory)); err != nil { + return fmt.Errorf("Sync2: %v", err) + } + return sess.Commit() +} |