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();
    $$
  );
