stacker.news/prisma/migrations/20230123180433_subs_timesta.../migration.sql

10 lines
415 B
PL/PgSQL

CREATE OR REPLACE FUNCTION timestamp_item_on_insert() RETURNS TRIGGER AS $$
BEGIN
IF NEW."subName" IS NOT NULL THEN
RETURN NEW;
END IF;
-- insert indexItem pgboss.job with itemId
INSERT INTO pgboss.job (name, data, startafter) VALUES ('timestampItem', jsonb_build_object('id', NEW.id), now() + interval '10 minutes');
RETURN NEW;
END;
$$ LANGUAGE plpgsql;