MySQL Error "There can be is only one TIMESTAMP column with current_timestamp in DEFAULT clause" even though I ' m doing nothin G wrong
http://jasonbos.co/two-timestamp-columns-in-mysql/
This is a very common table: There are create_time, update_time, even can be said to be normative, of course we would like these times to automatically update, to MySQL processing, but the problem came:
Create a table such as:
CREATE TABLE ' test_table ' (' ID ' INT () not NULL, ' created_at ' TIMESTAMP not null DEFAULT current_timestamp, ' updated_at ') TIMESTAMP not NULL DEFAULT current_timestamp on UPDATE current_timestamp) ENGINE = INNODB;
The original MySQL will automatically process:
CREATE TABLE ' test_table ' (' ID ' INT () not NULL, ' created_at ' TIMESTAMP not NULL for DEFAULT 0, ' updated_at ' TIMESTAMP not NU LL DEFAULT current_timestamp on UPDATE current_timestamp) ENGINE = INNODB;
INSERT into test_table (ID, created_at, updated_at) VALUES (1, NULL, NULL);
Has fun ...
MySQL can only have one column is the timestamp problem