1
0
mirror of https://github.com/quay/quay.git synced 2026-01-27 18:42:52 +03:00
Files
quay/tools/orphans.py
Kenny Lee Sin Cheong 4ad5a458c2 chore: remove uploading filtering from imagestorage queries (PROJQUAY-1914) (#764)
The "uploading" column is an artifact from depending on writing to the
Image table (see BlobUpload table instead). As of 3.4, Quay no longer
writes to that table, and is only needed until quayio moves away from
Clair v2, after which work to remove "glue" code and fully deprecate
the Image table (amongst other tables) can start.

This is done as a separate commit from the actual migration so that it
can be cherrypicked.
2021-04-21 13:53:28 -04:00

16 lines
312 B
Python

from data.database import Image, ImageStorage
from peewee import JOIN, fn
from app import app
orphaned = (
ImageStorage.select()
.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)