aboutsummaryrefslogtreecommitdiffstats
path: root/models/migrations/v61.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/v61.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/v61.go')
-rw-r--r--models/migrations/v61.go45
1 files changed, 0 insertions, 45 deletions
diff --git a/models/migrations/v61.go b/models/migrations/v61.go
deleted file mode 100644
index 13affaf068..0000000000
--- a/models/migrations/v61.go
+++ /dev/null
@@ -1,45 +0,0 @@
-// Copyright 2018 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"
- "os"
- "path"
-
- "code.gitea.io/gitea/modules/log"
- "code.gitea.io/gitea/modules/setting"
-
- "xorm.io/xorm"
-)
-
-func addSizeToAttachment(x *xorm.Engine) error {
- type Attachment struct {
- ID int64 `xorm:"pk autoincr"`
- UUID string `xorm:"uuid UNIQUE"`
- Size int64 `xorm:"DEFAULT 0"`
- }
- if err := x.Sync2(new(Attachment)); err != nil {
- return fmt.Errorf("Sync2: %v", err)
- }
-
- attachments := make([]Attachment, 0, 100)
- if err := x.Find(&attachments); err != nil {
- return fmt.Errorf("query attachments: %v", err)
- }
- for _, attach := range attachments {
- localPath := path.Join(setting.AttachmentPath, attach.UUID[0:1], attach.UUID[1:2], attach.UUID)
- fi, err := os.Stat(localPath)
- if err != nil {
- log.Error("calculate file size of attachment[UUID: %s]: %v", attach.UUID, err)
- continue
- }
- attach.Size = fi.Size()
- if _, err := x.ID(attach.ID).Cols("size").Update(attach); err != nil {
- return fmt.Errorf("update size column: %v", err)
- }
- }
- return nil
-}