Skip to content

Instantly share code, notes, and snippets.

@stevenmc
Created October 30, 2015 14:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stevenmc/659a27bf5a1300b274c4 to your computer and use it in GitHub Desktop.
Save stevenmc/659a27bf5a1300b274c4 to your computer and use it in GitHub Desktop.
Set default value of mysql field to function.
CREATE TRIGGER before_insert_news_item
BEFORE INSERT ON news
FOR EACH ROW
SET new.created = now();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment