Skip to content

Instantly share code, notes, and snippets.

@alexandre-jacquot-ptl
Created May 23, 2021 16:18
Show Gist options
  • Save alexandre-jacquot-ptl/ef31141a17199659fca05a805aaab805 to your computer and use it in GitHub Desktop.
Save alexandre-jacquot-ptl/ef31141a17199659fca05a805aaab805 to your computer and use it in GitHub Desktop.
r2dbc item_deleted_trigger
CREATE FUNCTION notify_item_deleted()
RETURNS TRIGGER
AS
BEGIN
PERFORM pg_notify('ITEM_DELETED', row_to_json(OLD)::text);
RETURN NULL;
END;
CREATE TRIGGER item_deleted_trigger
AFTER DELETE
ON item
FOR EACH ROW
EXECUTE PROCEDURE notify_item_deleted();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment