stacker.news/prisma/migrations/20240723151608_this_day/migration.sql

16 lines
381 B
PL/PgSQL

CREATE OR REPLACE FUNCTION schedule_this_day_job()
RETURNS INTEGER
LANGUAGE plpgsql
AS $$
DECLARE
BEGIN
INSERT INTO pgboss.schedule (name, cron, timezone)
VALUES ('thisDay', '0 5 * * *', 'America/Chicago') ON CONFLICT DO NOTHING;
return 0;
EXCEPTION WHEN OTHERS THEN
return 0;
END;
$$;
SELECT schedule_this_day_job();
DROP FUNCTION IF EXISTS schedule_this_day_job;