From 141f664bf7993d51bb0251c413c9fcd206f8f5d0 Mon Sep 17 00:00:00 2001 From: Joseph Schorr Date: Tue, 15 Dec 2015 13:15:10 -0500 Subject: [PATCH] Fix subquery delete which messes up MySQL Fixes #1061 --- data/model/repository.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/data/model/repository.py b/data/model/repository.py index 6b9ea7f39..b613cd152 100644 --- a/data/model/repository.py +++ b/data/model/repository.py @@ -49,7 +49,10 @@ def _purge_all_repository_tags(namespace_name, repository_name): (namespace_name, repository_name)) # Delete all manifests. - repo_tags = RepositoryTag.select().where(RepositoryTag.repository == repo.id) + repo_tags = list(RepositoryTag.select().where(RepositoryTag.repository == repo.id)) + if not repo_tags: + return + TagManifest.delete().where(TagManifest.tag << repo_tags).execute() # Delete all tags.