An error occurred while creating the table.
[Err] 1293-Incorrect table definition; there can be only one timestamp column with current_timestamp in default or on update clause
The creation statement is as follows:
CREATE TABLE company_news( id VARCHAR(32) NOT NULL, title VARCHAR(50) NOT NULL, summary VARCHAR(300), content TEXT, company_token VARCHAR(30) NOT NULL, modify_by VARCHAR(128), published_time TIMESTAMP, modify_time TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, primary key(id));
Cause:
One timestamp column in a table can have the current timestamp as the default value for initializing the column, as the auto-update value, or both.It is not possible to have the current timestamp be the default value for one column and the auto-update value for another column. (From the MySQL 5.5 Documentation)
This problem does not occur in MySQL 5.6,
Previusly, at most one timestamp column per table cocould be automatically initialized or updated to the current date and time.This restriction has been lifted.Any timestamp column definition can have any combination of default current_timestamp and on update current_timestamp clses. in addition, these clses now can be used with datetime column definitions. for more information, see initiic initialization and updating for Timestamp and datetime. (from the MySQL 5.6.5 Documentation)
You can consider the following solutions:
CREATE TABLE company_news( id VARCHAR(32) NOT NULL, title VARCHAR(50) NOT NULL, summary VARCHAR(300), content TEXT, company_token VARCHAR(30) NOT NULL, modify_by VARCHAR(128), published_time TIMESTAMP DEFAULT ‘0000-00-00 00:00:00‘, modify_time TIMESTAMP DEFAULT now() ON UPDATE now(), primary key(id));
There can be only one timestamp column with current_timestamp in default or on update clause