summaryrefslogtreecommitdiffstats
path: root/models/migrations
diff options
context:
space:
mode:
authorLunny Xiao <xiaolunwen@gmail.com>2020-01-24 01:28:15 +0800
committerLauris BH <lauris@nix.lv>2020-01-23 19:28:15 +0200
commitf6067a8465e7762aea1561106cfee291409a0fd6 (patch)
tree35c97d4117acfe52dce32c9242e4c9a656c4bc6c /models/migrations
parentbfdfa9a8b32ae331f98137169693ba1d71c25b09 (diff)
downloadgitea-f6067a8465e7762aea1561106cfee291409a0fd6.tar.gz
gitea-f6067a8465e7762aea1561106cfee291409a0fd6.zip
Migrate reviews when migrating repository from github (#9463)
* fix typo * Migrate reviews when migrating repository from github * fix lint * Added test and migration when external user login * fix test * fix commented state * Some improvements * fix bug when get pull request and ref original author on code comments * Fix migrated line; Added comment for review * Don't load all pull requests attributes * Fix typo * wrong change copy head * fix tests * fix reactions * Fix test * fix fmt * fix review comment reactions
Diffstat (limited to 'models/migrations')
-rw-r--r--models/migrations/migrations.go2
-rw-r--r--models/migrations/v125.go23
2 files changed, 25 insertions, 0 deletions
diff --git a/models/migrations/migrations.go b/models/migrations/migrations.go
index 226368b7f3..286e809abb 100644
--- a/models/migrations/migrations.go
+++ b/models/migrations/migrations.go
@@ -304,6 +304,8 @@ var migrations = []Migration{
NewMigration("Add original informations for reactions", addReactionOriginals),
// v124 -> v125
NewMigration("Add columns to user and repository", addUserRepoMissingColumns),
+ // v125 -> v126
+ NewMigration("Add some columns on review for migration", addReviewMigrateInfo),
}
// Migrate database to current version
diff --git a/models/migrations/v125.go b/models/migrations/v125.go
new file mode 100644
index 0000000000..ac567f66b9
--- /dev/null
+++ b/models/migrations/v125.go
@@ -0,0 +1,23 @@
+// Copyright 2020 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"
+
+ "xorm.io/xorm"
+)
+
+func addReviewMigrateInfo(x *xorm.Engine) error {
+ type Review struct {
+ OriginalAuthor string
+ OriginalAuthorID int64
+ }
+
+ if err := x.Sync2(new(Review)); err != nil {
+ return fmt.Errorf("Sync2: %v", err)
+ }
+ return nil
+}