diff options
author | Lunny Xiao <xiaolunwen@gmail.com> | 2019-12-17 14:58:30 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-12-17 14:58:30 +0800 |
commit | 59fc29db383142586b6ac5cab7b324f16553e561 (patch) | |
tree | 4b0f0813059b19fa9973099994d778ed1c90b673 | |
parent | ffc904b1e0635d17e55b5fbdea4e18832ee2276d (diff) | |
download | gitea-59fc29db383142586b6ac5cab7b324f16553e561.tar.gz gitea-59fc29db383142586b6ac5cab7b324f16553e561.zip |
fix wrong migration (#9381)
-rw-r--r-- | models/migrations/v112.go | 3 |
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 } |