X-Git-Url: http://wagnertech.de/gitweb/gitweb.cgi/mfinanz.git/blobdiff_plain/deb4d2dbb676d7d6f69dfe7815d6e0cb09bd4a44..53593baa211863fbf66540cf1bcc36c8fb37257f:/sql/Pg-upgrade2/emmvee_background_jobs_2.sql

diff --git a/sql/Pg-upgrade2/emmvee_background_jobs_2.sql b/sql/Pg-upgrade2/emmvee_background_jobs_2.sql
new file mode 100644
index 000000000..a0d617852
--- /dev/null
+++ b/sql/Pg-upgrade2/emmvee_background_jobs_2.sql
@@ -0,0 +1,12 @@
+-- @tag: emmvee_background_jobs_2
+-- @description: Hintergrundjobs einrichten
+-- @depends: emmvee_background_jobs
+INSERT INTO background_jobs (type, package_name, active, cron_spec, next_run_at)
+VALUES ('interval', 'CleanBackgroundJobHistory', true, '0 3 * * *',
+  CAST(current_date AS timestamp) + CAST(
+    (CASE
+     WHEN extract('hour' FROM current_timestamp) < 3 THEN '3 hours'
+     ELSE                                                 '1 day 3 hours'
+     END) AS interval
+  )
+);
