0
0
Fork 0

Clean up unused application records (#24871)

This commit is contained in:
Claire 2023-07-21 13:13:16 +02:00 committed by GitHub
parent 5cbc402687
commit 144a406d33
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 66 additions and 0 deletions

View file

@ -0,0 +1,10 @@
# frozen_string_literal: true
class Vacuum::ApplicationsVacuum
def perform
Doorkeeper::Application.where(owner_id: nil)
.where.missing(:created_users, :access_tokens, :access_grants)
.where(created_at: ...1.day.ago)
.in_batches.delete_all
end
end