Created
May 23, 2021 16:18
-
-
Save alexandre-jacquot-ptl/ef31141a17199659fca05a805aaab805 to your computer and use it in GitHub Desktop.
r2dbc item_deleted_trigger
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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