I'm using the Sequel Pro app to work with my db.
Using Mysql 5.7.
I have the following table structure. When I attempt to reorder the 'created' table column, I get an error from mysql "Invalid default value for 'created'.
I have no rows in the materials
table when attempting the reorder.
From everything I've read, CURRENT_TIMESTAMP is the correct default value.
CREATE TABLE `materials` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`created` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
`modified` datetime NOT NULL ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8;
My goal is to have the created
column be automatically filled when the row is added. modified
will automatically update to the current time when changed.
What am I missing?