ensure stats for supporter children are retained

This commit is contained in:
Kyle Drake 2020-04-30 00:44:00 -07:00
parent 10018c5124
commit 3057eda4b0
2 changed files with 9 additions and 2 deletions

View file

@ -12,8 +12,9 @@ class Stat < Sequel::Model
class << self
def prune!
DB[
"DELETE FROM stats WHERE created_at < ? AND site_id NOT IN (SELECT id FROM sites WHERE plan_type IS NOT NULL OR plan_type != 'free')",
(FREE_RETAINMENT_DAYS-1).days.ago.to_date.to_s
"DELETE FROM stats WHERE created_at < ? AND site_id NOT IN ?",
(FREE_RETAINMENT_DAYS-1).days.ago.to_date.to_s,
Site.supporter_ids
].first
end