Fix subquery on MySQL

This commit is contained in:
Joseph Schorr 2015-03-17 13:54:51 -04:00
parent 44ff85d044
commit fe8d006855

View file

@ -1459,7 +1459,8 @@ def set_image_size(docker_image_id, namespace_name, repository_name, image_size,
# total_size = image_size + parent_image.storage.aggregate_size # total_size = image_size + parent_image.storage.aggregate_size
total_size = (ImageStorage.select(fn.Sum(ImageStorage.image_size)) total_size = (ImageStorage.select(fn.Sum(ImageStorage.image_size))
.join(Image) .join(Image)
.where(Image.id << ancestors)) + image_size .where(Image.id << ancestors)
.scalar()) + image_size
image.storage.aggregate_size = total_size image.storage.aggregate_size = total_size
except Image.DoesNotExist: except Image.DoesNotExist: