Created
May 10, 2012 14:58
-
-
Save dmdavis/2653700 to your computer and use it in GitHub Desktop.
Automatic MySql Timestamps
This file contains hidden or 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
| -- Limited to one default TIMESTAMP column per table | |
| -- See http://stackoverflow.com/questions/4489548/why-there-can-be-only-one-timestamp-column-with-current-timestamp-in-default-cla | |
| CREATE TABLE my_table ( | |
| -- some columns | |
| updated TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP | |
| ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment