Problem when i try to alter table oxnews

ALTER TABLE oxnews ADD COLUMN OXPIC char(32) NOT NULL;

ERROR 1067 (42000): Invalid default value for 'OXACTIVEFROM

anyone knows why i can’t add a columns in the table?
Thank you.

As of MYSQL 5.7 the default timestamp may not be set to a zerofill timestamp value anymore. This error is only thrown when strict mode is enabled in your MYSQL setup. Either disable strict mode or change the default value to the new default value for timestamps.

Just as I had this on my local dev environment, here is a query I used to still add a new field into a ox table leaving the invalid null defaults:

SET SQL_MODE='ALLOW_INVALID_DATES';
ALTER TABLE `oxarticles` ADD `MIBSECONDHEADLINE` VARCHAR(255) NOT NULL DEFAULT '';
1 Like