2017年2月16日 星期四

Why there can be only one TIMESTAMP column with CURRENT_TIMESTAMP in DEFAULT clause?



Why there can be only one TIMESTAMP column with CURRENT_TIMESTAMP in DEFAULT clause?


Ref : http://stackoverflow.com/questions/4489548/why-there-can-be-only-one-timestamp-column-with-current-timestamp-in-default-cla


CREATE TABLE `test_table` (
`id` INT( 10 ) NOT NULL,
`created_at` TIMESTAMP NOT NULL DEFAULT 0,
`updated_at` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
) ENGINE = INNODB;

沒有留言:

張貼留言