Add pruning of reports older than a week

This commit is contained in:
BrokenEagle
2020-01-18 21:41:45 +00:00
parent a3e889bdf5
commit 491d476456
2 changed files with 5 additions and 0 deletions

View File

@@ -17,6 +17,7 @@ module DanbooruMaintenance
safely { TagChangeRequestPruner.warn_all }
safely { TagChangeRequestPruner.reject_all }
safely { Ban.prune! }
safely { ModerationReport.prune! }
safely { CuratedPoolUpdater.update_pool! }
safely { ActiveRecord::Base.connection.execute("vacuum analyze") unless Rails.env.test? }
end

View File

@@ -54,4 +54,8 @@ class ModerationReport < ApplicationRecord
q.apply_default_order(params)
end
def self.prune!
where("created_at < ?", 1.week.ago).delete_all
end
end