summaryrefslogtreecommitdiffstats
path: root/models
diff options
context:
space:
mode:
authorLunny Xiao <xiaolunwen@gmail.com>2019-12-17 14:58:30 +0800
committerGitHub <noreply@github.com>2019-12-17 14:58:30 +0800
commit59fc29db383142586b6ac5cab7b324f16553e561 (patch)
tree4b0f0813059b19fa9973099994d778ed1c90b673 /models
parentffc904b1e0635d17e55b5fbdea4e18832ee2276d (diff)
downloadgitea-59fc29db383142586b6ac5cab7b324f16553e561.tar.gz
gitea-59fc29db383142586b6ac5cab7b324f16553e561.zip
fix wrong migration (#9381)
Diffstat (limited to 'models')
-rw-r--r--models/migrations/v112.go3
1 files changed, 2 insertions, 1 deletions
diff --git a/models/migrations/v112.go b/models/migrations/v112.go
index c1087b0c47..2c4f659675 100644
--- a/models/migrations/v112.go
+++ b/models/migrations/v112.go
@@ -20,6 +20,7 @@ func removeAttachmentMissedRepo(x *xorm.Engine) error {
attachments := make([]*Attachment, 0, 50)
for {
err := x.Select("uuid").Where(builder.NotIn("release_id", builder.Select("id").From("`release`"))).
+ And("release_id > 0").
OrderBy("id").Limit(50, start).Find(&attachments)
if err != nil {
return err
@@ -36,6 +37,6 @@ func removeAttachmentMissedRepo(x *xorm.Engine) error {
attachments = attachments[:0]
}
- _, err := x.Exec("DELETE FROM attachment WHERE release_id NOT IN (SELECT id FROM `release`)")
+ _, err := x.Exec("DELETE FROM attachment WHERE release_id > 0 AND release_id NOT IN (SELECT id FROM `release`)")
return err
}