From 248f57a69298012c0f670d4f62b6a49c47a0f3b9 Mon Sep 17 00:00:00 2001 From: Guillermo Prandi Date: Wed, 9 Oct 2019 01:13:23 -0300 Subject: [PATCH 1/2] Fix migration v96 to keep issue attachments --- models/migrations/v96.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/models/migrations/v96.go b/models/migrations/v96.go index 5c2135ffc6ad4..cd49b3b74c7d2 100644 --- a/models/migrations/v96.go +++ b/models/migrations/v96.go @@ -27,7 +27,7 @@ func deleteOrphanedAttachments(x *xorm.Engine) error { defer sess.Close() err := sess.BufferSize(setting.Database.IterateBufferSize). - Where("`comment_id` = 0 and (`release_id` = 0 or `release_id` not in (select `id` from `release`))").Cols("uuid"). + Where("`issue_id` == 0 and `comment_id` = 0 and (`release_id` = 0 or `release_id` not in (select `id` from `release`))").Cols("uuid"). Iterate(new(Attachment), func(idx int, bean interface{}) error { attachment := bean.(*Attachment) From 08cfb1eb2665283039555298a22bd3de72c0668f Mon Sep 17 00:00:00 2001 From: Guillermo Prandi Date: Wed, 9 Oct 2019 01:26:56 -0300 Subject: [PATCH 2/2] Fix == operator --- models/migrations/v96.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/models/migrations/v96.go b/models/migrations/v96.go index cd49b3b74c7d2..34f67534c267c 100644 --- a/models/migrations/v96.go +++ b/models/migrations/v96.go @@ -27,7 +27,7 @@ func deleteOrphanedAttachments(x *xorm.Engine) error { defer sess.Close() err := sess.BufferSize(setting.Database.IterateBufferSize). - Where("`issue_id` == 0 and `comment_id` = 0 and (`release_id` = 0 or `release_id` not in (select `id` from `release`))").Cols("uuid"). + Where("`issue_id` = 0 and (`release_id` = 0 or `release_id` not in (select `id` from `release`))").Cols("uuid"). Iterate(new(Attachment), func(idx int, bean interface{}) error { attachment := bean.(*Attachment)