1
0
mirror of https://github.com/quay/quay.git synced 2026-01-26 06:21:37 +03:00
Files
quay/tools/orphans.py
2019-12-02 12:23:08 -05:00

17 lines
355 B
Python

from data.database import Image, ImageStorage
from peewee import JOIN, fn
from app import app
orphaned = (
ImageStorage.select()
.where(ImageStorage.uploading == False)
.join(Image, JOIN.LEFT_OUTER)
.group_by(ImageStorage)
.having(fn.Count(Image.id) == 0)
)
counter = 0
for orphan in orphaned:
counter += 1
print orphan.uuid