aboutsummaryrefslogtreecommitdiffstats
path: root/models/migrations/v96.go
diff options
context:
space:
mode:
author6543 <6543@obermui.de>2020-07-22 16:27:22 +0200
committerGitHub <noreply@github.com>2020-07-22 09:27:22 -0500
commit2753d72773ae75e326d342757aa0159642a4a794 (patch)
tree41137eae1e0d423d4ea22434fcd318aca3ade05f /models/migrations/v96.go
parent8e20daaede6831be1309f5b27af382bbd1d82aad (diff)
downloadgitea-2753d72773ae75e326d342757aa0159642a4a794.tar.gz
gitea-2753d72773ae75e326d342757aa0159642a4a794.zip
Migrations (v82,v96,v99,v136) remove dependencies (#12286)
* remove dependencys * add missing fields * CI.restart()
Diffstat (limited to 'models/migrations/v96.go')
-rw-r--r--models/migrations/v96.go10
1 files changed, 8 insertions, 2 deletions
diff --git a/models/migrations/v96.go b/models/migrations/v96.go
index 7a1684354a..9840248f61 100644
--- a/models/migrations/v96.go
+++ b/models/migrations/v96.go
@@ -6,8 +6,8 @@ package migrations
import (
"os"
+ "path"
- "code.gitea.io/gitea/models"
"code.gitea.io/gitea/modules/setting"
"xorm.io/xorm"
@@ -23,6 +23,12 @@ func deleteOrphanedAttachments(x *xorm.Engine) error {
CommentID int64
}
+ // AttachmentLocalPath returns where attachment is stored in local file
+ // system based on given UUID.
+ AttachmentLocalPath := func(uuid string) string {
+ return path.Join(setting.AttachmentPath, uuid[0:1], uuid[1:2], uuid)
+ }
+
sess := x.NewSession()
defer sess.Close()
@@ -52,7 +58,7 @@ func deleteOrphanedAttachments(x *xorm.Engine) error {
}
for _, attachment := range attachements {
- if err := os.RemoveAll(models.AttachmentLocalPath(attachment.UUID)); err != nil {
+ if err := os.RemoveAll(AttachmentLocalPath(attachment.UUID)); err != nil {
return err
}
}