Fix daily cleanup script for rails 5.2 compatibility
authorTom Hughes <tom@compton.nu>
Wed, 20 Jun 2018 07:51:11 +0000 (08:51 +0100)
committerTom Hughes <tom@compton.nu>
Wed, 20 Jun 2018 07:51:11 +0000 (08:51 +0100)
script/cleanup

index 3eaeef7c6a739efa50ddb71f930cbb22c1869094..10fdf9db7328dc1a3c1db8105d9345c0c42397d7 100755 (executable)
@@ -2,7 +2,7 @@
 
 require File.dirname(__FILE__) + "/../config/environment"
 
-UserToken.delete_all("expiry < NOW()")
-OauthNonce.delete_all("timestamp < EXTRACT(EPOCH FROM NOW() - INTERVAL '1 day')")
+UserToken.where("expiry < NOW()").delete_all
+OauthNonce.where("timestamp < EXTRACT(EPOCH FROM NOW() - INTERVAL '1 day')").delete_all
 
 exit 0