summaryrefslogtreecommitdiffstats
path: root/models/migrations/v39.go
diff options
context:
space:
mode:
authorguillep2k <18600385+guillep2k@users.noreply.github.com>2020-01-31 10:42:45 -0300
committerGitHub <noreply@github.com>2020-01-31 21:42:45 +0800
commitd816f7018b0726f868fa0cddf02ffae184601395 (patch)
treeff1a08e7dab91a45afef0e53a5d006f074613987 /models/migrations/v39.go
parentb3d8e2d4f7a0ebf768ab6bcb102755839a6b9311 (diff)
downloadgitea-d816f7018b0726f868fa0cddf02ffae184601395.tar.gz
gitea-d816f7018b0726f868fa0cddf02ffae184601395.zip
Remove migration support from versions earlier than 1.6.0 (#10026)
* Remove migration support from versions earlier than 1.6.0 * Remove unused functions * Update gogs upgrade instructions * Improve "latest" link as per @jolheiser Co-authored-by: Antoine GIRARD <sapk@users.noreply.github.com> Co-authored-by: Lauris BH <lauris@nix.lv> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Diffstat (limited to 'models/migrations/v39.go')
-rw-r--r--models/migrations/v39.go59
1 files changed, 0 insertions, 59 deletions
diff --git a/models/migrations/v39.go b/models/migrations/v39.go
deleted file mode 100644
index e0b84b969c..0000000000
--- a/models/migrations/v39.go
+++ /dev/null
@@ -1,59 +0,0 @@
-// Copyright 2017 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/models"
- "code.gitea.io/gitea/modules/git"
- "code.gitea.io/gitea/modules/log"
- "code.gitea.io/gitea/modules/repository"
-
- "xorm.io/xorm"
-)
-
-// ReleaseV39 describes the added field for Release
-type ReleaseV39 struct {
- IsTag bool `xorm:"NOT NULL DEFAULT false"`
-}
-
-// TableName will be invoked by XORM to customrize the table name
-func (*ReleaseV39) TableName() string {
- return "release"
-}
-
-func releaseAddColumnIsTagAndSyncTags(x *xorm.Engine) error {
- if err := x.Sync2(new(ReleaseV39)); err != nil {
- return fmt.Errorf("Sync2: %v", err)
- }
-
- // For the sake of SQLite3, we can't use x.Iterate here.
- offset := 0
- pageSize := models.RepositoryListDefaultPageSize
- for {
- repos := make([]*models.Repository, 0, pageSize)
- if err := x.Table("repository").Cols("id", "name", "owner_id").Asc("id").Limit(pageSize, offset).Find(&repos); err != nil {
- return fmt.Errorf("select repos [offset: %d]: %v", offset, err)
- }
- for _, repo := range repos {
- gitRepo, err := git.OpenRepository(repo.RepoPath())
- if err != nil {
- log.Warn("OpenRepository: %v", err)
- continue
- }
-
- if err = repository.SyncReleasesWithTags(repo, gitRepo); err != nil {
- log.Warn("SyncReleasesWithTags: %v", err)
- }
- gitRepo.Close()
- }
- if len(repos) < pageSize {
- break
- }
- offset += pageSize
- }
- return nil
-}