aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrancis Irving <francis@mysociety.org>2010-06-10 11:33:46 +0100
committerFrancis Irving <francis@mysociety.org>2010-06-10 11:33:46 +0100
commit06e25f0e900cd1780a4b1446c67b8dc45b36176f (patch)
treef36e312aadb3672c06024ec8ebe5fe2dab76c79b
parent98df56f2a431702fece99314e987bbdd2a3f0a9d (diff)
Delete old track things sent records.
-rw-r--r--app/models/post_redirect.rb2
-rw-r--r--app/models/track_things_sent_email.rb6
-rwxr-xr-xscript/delete-old-things2
3 files changed, 9 insertions, 1 deletions
diff --git a/app/models/post_redirect.rb b/app/models/post_redirect.rb
index 655b3ac58..a17b24d16 100644
--- a/app/models/post_redirect.rb
+++ b/app/models/post_redirect.rb
@@ -86,7 +86,7 @@ class PostRedirect < ActiveRecord::Base
return post_redirects[0]
end
- # Called from cron job delete-old-post-redirects
+ # Called from cron job delete-old-things
def self.delete_old_post_redirects
PostRedirect.delete_all "updated_at < (now() - interval '6 months')"
end
diff --git a/app/models/track_things_sent_email.rb b/app/models/track_things_sent_email.rb
index 35229371c..b39dad932 100644
--- a/app/models/track_things_sent_email.rb
+++ b/app/models/track_things_sent_email.rb
@@ -25,6 +25,12 @@ class TrackThingsSentEmail < ActiveRecord::Base
belongs_to :user
belongs_to :public_body
belongs_to :track_thing
+
+ # Called from cron job delete-old-things
+ def self.delete_old_track_things_sent_email
+ TrackThingsSentEmail.delete_all "updated_at < (now() - interval '1 month')"
+ end
+
end
diff --git a/script/delete-old-things b/script/delete-old-things
index c1354e4f4..18e802ec7 100755
--- a/script/delete-old-things
+++ b/script/delete-old-things
@@ -4,4 +4,6 @@ LOC=`dirname $0`
$LOC/runner 'PostRedirect.delete_old_post_redirects()'
+$LOC/runner 'TrackThingsSentEmail.delete_old_track_things_sent_email()'
+