diff options
author | Lunny Xiao <xiaolunwen@gmail.com> | 2020-01-10 23:35:17 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-01-10 23:35:17 +0800 |
commit | 7a3a90aca3c4a8258805efa10022a81e4d1a4d73 (patch) | |
tree | 54d92bac08a2aa336825cd1545dcd19fba028c96 /models/migrations | |
parent | 3143bb10da25cd66383c23aff7b31dbd7c3dd9d6 (diff) | |
download | gitea-7a3a90aca3c4a8258805efa10022a81e4d1a4d73.tar.gz gitea-7a3a90aca3c4a8258805efa10022a81e4d1a4d73.zip |
Fix wrong original git service type on a migrated repository (#9693)
Diffstat (limited to 'models/migrations')
-rw-r--r-- | models/migrations/migrations.go | 2 | ||||
-rw-r--r-- | models/migrations/v119.go | 16 |
2 files changed, 18 insertions, 0 deletions
diff --git a/models/migrations/migrations.go b/models/migrations/migrations.go index f26566b045..dc5cc48c64 100644 --- a/models/migrations/migrations.go +++ b/models/migrations/migrations.go @@ -292,6 +292,8 @@ var migrations = []Migration{ NewMigration("Add block on rejected reviews branch protection", addBlockOnRejectedReviews), // v118 -> v119 NewMigration("Add commit id and stale to reviews", addReviewCommitAndStale), + // v119 -> v120 + NewMigration("Fix migrated repositories' git service type", fixMigratedRepositoryServiceType), } // Migrate database to current version diff --git a/models/migrations/v119.go b/models/migrations/v119.go new file mode 100644 index 0000000000..746a04ead4 --- /dev/null +++ b/models/migrations/v119.go @@ -0,0 +1,16 @@ +// 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 ( + "code.gitea.io/gitea/modules/structs" + + "xorm.io/xorm" +) + +func fixMigratedRepositoryServiceType(x *xorm.Engine) error { + _, err := x.Exec("UPDATE repository SET original_service_type = ? WHERE original_url LIKE 'https://github.com/%'", structs.GithubService) + return err +} |