I have currently following SQL table:
CREATE TABLE IF NOT EXISTS `xyz` ( `id` bigint(20) NOT NULL, `guid` char(36) NOT NULL, `ts_created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, `ts_modified` timestamp NULL DEFAULT NULL, ................ ) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=REDUNDANT AUTO_INCREMENT=1 ;
ts_created is the timestamp when the entry was created. The default value is
ts_modified is the timestamp when the entry was updated.
In phpMyAdmin, I could choose
ON UPDATE CURRENT_TIMESTAMP for
ts_modified. This would be exactly what I want.
But the error message is following:
#1293 - Incorrect table definition; there can be only one TIMESTAMP column with CURRENT_TIMESTAMP in DEFAULT or ON UPDATE clause
The error message is clear to me, but it is not clear to me
1) why this constraint is existing, since the "default" value (on create) and the "on update" value are two different things.
2) Is there anything I could do, or do I have to add
ts_modified = NOW() at every