Untitled

mail@pastecode.io avatar
unknown
plain_text
2 months ago
590 B
5
Indexable
Never
CREATE OR REPLACE FUNCTION public.simple_trigger_test() RETURNS TRIGGER AS $$
BEGIN
    RAISE LOG 'Test log message';
    SET search_path = public, stripe, auth, pg_catalog;
    INSERT INTO public.debug_log(message) VALUES ('Simple trigger test executed.');
    RETURN NEW;
END
$$ LANGUAGE plpgsql SECURITY DEFINER;

-- Make sure to drop the existing trigger before creating a new one
DROP TRIGGER IF EXISTS simple_test_trigger ON stripe.invoices;

CREATE TRIGGER simple_test_trigger
AFTER INSERT ON stripe.invoices
FOR EACH ROW
EXECUTE FUNCTION public.simple_trigger_test();
Leave a Comment