Skip to content

Instantly share code, notes, and snippets.

@dhrrgn
Created March 7, 2014 15:29
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 dhrrgn/9413550 to your computer and use it in GitHub Desktop.
Save dhrrgn/9413550 to your computer and use it in GitHub Desktop.
DROP TRIGGER IF EXISTS touch_updated_ones;
CREATE TRIGGER touch_updated_ones BEFORE UPDATE ON `super_secret_table_name`
FOR EACH ROW SET NEW.touched = UNIX_TIMESTAMP();
DROP TRIGGER IF EXISTS touch_new_ones;
CREATE TRIGGER touch_new_ones BEFORE INSERT ON `super_secret_table_name`
FOR EACH ROW SET NEW.touched = UNIX_TIMESTAMP();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment