Advertisement
Dyrcona

purge_reports.sql

Sep 20th, 2023
818
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. BEGIN;
  2.  
  3. DELETE FROM reporter.schedule WHERE run_time<NOW()-INTERVAL '60 days';
  4. DELETE  FROM reporter.report WHERE create_time<NOW()-INTERVAL '60 days' AND recur=FALSE AND id NOT IN
  5. (SELECT r.id FROM reporter.report r INNER JOIN reporter.schedule s ON r.id=s.report);
  6.  
  7. COMMIT;
  8.  
  9.  
  10.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement