From d26d008b47560873d3e93dff3cb4b74b95e3f188 Mon Sep 17 00:00:00 2001 From: xbgmsharp Date: Sat, 1 Apr 2023 19:28:38 +0200 Subject: [PATCH] Update job_run_details_cleanup_fn to remove logs older than 90 days --- initdb/02_2_signalk_cron.sql | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/initdb/02_2_signalk_cron.sql b/initdb/02_2_signalk_cron.sql index 9d79395..11dc59c 100644 --- a/initdb/02_2_signalk_cron.sql +++ b/initdb/02_2_signalk_cron.sql @@ -350,13 +350,12 @@ COMMENT ON FUNCTION -- CRON for Vacuum database CREATE FUNCTION job_run_details_cleanup_fn() RETURNS void AS $$ --- ERROR: VACUUM cannot be executed from a function DECLARE BEGIN - -- Remove job run log older than 3 month + -- Remove job run log older than 3 months RAISE NOTICE 'job_run_details_cleanup_fn'; DELETE FROM postgres.cron.job_run_details - WHERE start_time <= NOW() AT TIME ZONE 'UTC' - INTERVAL '61 DAYS'; + WHERE start_time <= NOW() AT TIME ZONE 'UTC' - INTERVAL '91 DAYS'; END; $$ language plpgsql; -- Description