Last active
May 23, 2021 16:18
-
-
Save alexandre-jacquot-ptl/d65fa36f85806e50737ab606cdcc573d to your computer and use it in GitHub Desktop.
r2dbc item_saved_trigger.sql
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_saved() | |
RETURNS TRIGGER | |
AS | |
BEGIN | |
PERFORM pg_notify('ITEM_SAVED', row_to_json(NEW)::text); | |
RETURN NULL; | |
END; | |
CREATE TRIGGER item_saved_trigger | |
AFTER INSERT OR UPDATE | |
ON item | |
FOR EACH ROW | |
EXECUTE PROCEDURE notify_item_saved(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment