Created
April 26, 2018 16:13
-
-
Save otikev/717b05830bce6cb5b013e97a1bf0c050 to your computer and use it in GitHub Desktop.
Postgres trigger for an update
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 OR REPLACE FUNCTION categorySyncLogUpdate() | |
RETURNS trigger AS $$ | |
BEGIN | |
INSERT INTO shared.sync_logs(record_id,record_type,log_type) VALUES (NEW.id,1,2); | |
RETURN NEW; | |
END; | |
$$ LANGUAGE 'plpgsql'; | |
CREATE TRIGGER update_category_sync_log AFTER UPDATE ON jobs.categories FOR EACH ROW | |
EXECUTE PROCEDURE categorySyncLogUpdate(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment