aboutsummaryrefslogtreecommitdiffstats
path: root/models/migrations
diff options
context:
space:
mode:
authorLunny Xiao <xiaolunwen@gmail.com>2019-10-05 19:09:27 +0800
committerLauris BH <lauris@nix.lv>2019-10-05 14:09:27 +0300
commitbd41a04a5613a2e017b458351bea0f02b767b893 (patch)
treed13e42c1f9664e09ae432250caaeca78df70ee72 /models/migrations
parentfb7c23f911bebcb72f170f3d8bc8343546805f3b (diff)
downloadgitea-bd41a04a5613a2e017b458351bea0f02b767b893.tar.gz
gitea-bd41a04a5613a2e017b458351bea0f02b767b893.zip
Add extra user information when migrating release (#8331)
* add extra user information when migrating release * add migrations * fix tests
Diffstat (limited to 'models/migrations')
-rw-r--r--models/migrations/migrations.go2
-rw-r--r--models/migrations/v98.go17
2 files changed, 19 insertions, 0 deletions
diff --git a/models/migrations/migrations.go b/models/migrations/migrations.go
index 7680e7747c..1f5b918de8 100644
--- a/models/migrations/migrations.go
+++ b/models/migrations/migrations.go
@@ -250,6 +250,8 @@ var migrations = []Migration{
NewMigration("delete orphaned attachments", deleteOrphanedAttachments),
// v97 -> v98
NewMigration("add repo_admin_change_team_access to user", addRepoAdminChangeTeamAccessColumnForUser),
+ // v98 -> v99
+ NewMigration("add original author name and id on migrated release", addOriginalAuthorOnMigratedReleases),
}
// Migrate database to current version
diff --git a/models/migrations/v98.go b/models/migrations/v98.go
new file mode 100644
index 0000000000..3b9fdbb1c5
--- /dev/null
+++ b/models/migrations/v98.go
@@ -0,0 +1,17 @@
+// Copyright 2019 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 "github.com/go-xorm/xorm"
+
+func addOriginalAuthorOnMigratedReleases(x *xorm.Engine) error {
+ type Release struct {
+ ID int64
+ OriginalAuthor string
+ OriginalAuthorID int64 `xorm:"index"`
+ }
+
+ return x.Sync2(new(Release))
+}