Created
July 3, 2020 21:43
-
-
Save marcelogrsp/b6628d3b5a114bd4ec94c7fa8efeac96 to your computer and use it in GitHub Desktop.
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
DELIMITER $$ | |
CREATE TRIGGER `TRIGGER_NAME` BEFORE UPDATE ON `TABLE_NAME` | |
FOR EACH ROW | |
BEGIN | |
IF (NEW.FIELD_NAME is not null) THEN | |
SET NEW.FIELD_NAME = CURRENT_TIMESTAMP(); | |
END IF; | |
END $$ | |
DELIMITER ; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment