Fix cron jobs for prod

This commit is contained in:
projectmoon 2024-04-10 21:33:21 +02:00
parent 5096ed1f1a
commit 6de1ac2922
1 changed files with 25 additions and 0 deletions

View File

@ -0,0 +1,25 @@
select cron.unschedule(jobs.jobid) FROM cron.job jobs;
drop extension if exists pg_cron;
create extension if not exists pg_cron;
grant usage on schema cron to postgres;
grant all privileges on all tables in schema cron to postgres;
-- restore the jobs
SELECT
cron.schedule(
'drop-old-chunks',
'*/10 * * * *',
$$
SELECT drop_chunks('raw_bus_positions', INTERVAL '24 hours');
$$
);
SELECT
cron.schedule(
'download-bus-data',
'5 seconds',
$$
select gather_bus_data();
$$
);