0
0
Fork 0

Add created_before and updated_before scopes to MediaAttachment (#28869)

This commit is contained in:
Matt Jankowski 2024-01-24 05:32:54 -05:00 committed by GitHub
parent a11a2fb052
commit 7a1f087659
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 16 additions and 8 deletions

View file

@ -27,11 +27,17 @@ class Vacuum::MediaAttachmentsVacuum
end
def media_attachments_past_retention_period
MediaAttachment.remote.cached.where(MediaAttachment.arel_table[:created_at].lt(@retention_period.ago)).where(MediaAttachment.arel_table[:updated_at].lt(@retention_period.ago))
MediaAttachment
.remote
.cached
.created_before(@retention_period.ago)
.updated_before(@retention_period.ago)
end
def orphaned_media_attachments
MediaAttachment.unattached.where(MediaAttachment.arel_table[:created_at].lt(TTL.ago))
MediaAttachment
.unattached
.created_before(TTL.ago)
end
def retention_period?