

DO $$
DECLARE
    scid integer;
BEGIN
-- Inserting a schedule (jobid: <PGA_JOB_ID>)
INSERT INTO pgagent.pga_schedule(
    jscjobid, jscname, jscdesc, jscenabled,
    jscstart, jscend,    jscminutes, jschours, jscweekdays, jscmonthdays, jscmonths
) VALUES (
    <PGA_JOB_ID>, 'schedule_2'::text, 'test schedule_2 comment'::text, true,
    '2020-04-15 05:11:31 -07:00'::timestamp with time zone, '2020-04-16 05:11:34 -07:00'::timestamp with time zone,
    -- Minutes
    '{t,t,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,t,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f}'::bool[]::boolean[],
    -- Hours
    '{t,t,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f}'::bool[]::boolean[],
    -- Week days
    '{t,t,f,f,f,f,f}'::bool[]::boolean[],
    -- Month days
    '{t,t,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f}'::bool[]::boolean[],
    -- Months
    '{t,t,f,f,f,f,f,f,f,f,f,f}'::bool[]::boolean[]
) RETURNING jscid INTO scid;END
$$;
