Migrations (v82,v96,v99,v136) remove dependencies (#12286)

* remove dependencys

* add missing fields

* CI.restart()
This commit is contained in:
6543 2020-07-22 16:27:22 +02:00 committed by GitHub
parent 8e20daaede
commit 2753d72773
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 35 additions and 11 deletions

View file

@ -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
}
}