I'd like to accomplish something like the following in a MySQL Create table action
开发者_高级运维date_created datetime NOT NULL DEFAULT CURRENT_DATETIME,
date_updated datetime NOT NULL ON UPDATE CURRENT_DATETIME,
Once again, this is a MySQL create table action and these are two of the fields in my table.
Have a look at this
TIMESTAMP Properties
From the link you can use
CREATE TABLE t (ts TIMESTAMP DEFAULT CURRENT_TIMESTAMP
ON UPDATE CURRENT_TIMESTAMP);
CREATE TABLE t (ts TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
DEFAULT CURRENT_TIMESTAMP);
精彩评论