stacker.news/prisma/migrations/20231025203103_delete_unuse.../migration.sql

18 lines
442 B
PL/PgSQL

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