-- +goose Up
DROP TRIGGER job_insert_trigger ON job;
DROP FUNCTION notify_new_job();

-- +goose Down
-- +goose StatementBegin
CREATE OR REPLACE FUNCTION notify_new_job()
RETURNS TRIGGER AS $$
BEGIN
    PERFORM pg_notify('new_job', NEW.id::text);
    RETURN NEW;
END;
$$ LANGUAGE plpgsql;
-- +goose StatementEnd

CREATE TRIGGER job_insert_trigger
    AFTER INSERT ON job
    FOR EACH ROW
    EXECUTE FUNCTION notify_new_job();
