Mysql – invalid default value (thesql 5.7) for timestamp field

MySQLmysql-5.7

EDIT:
When updating an existing database from mysql 5.6 and executing:

UPDATE phppos_register_log SET shift_end = '2015-01-01 00:00:00' WHERE shift_end = '0000-00-00 00:00:00';

This produces:

#1292 - Incorrect datetime value: '0000-00-00 00:00:00' for column 'shift_end' at row 1
#1067 - Invalid default value for 'shift_start' 

This worked in mysql <=5.7. I couldn't find any documentation about this…What is the issue with this?

CREATE TABLE `phppos_register_log` (
      `register_log_id` int(10) NOT NULL AUTO_INCREMENT,
      `employee_id_open` int(10) NOT NULL,
      `employee_id_close` int(11) DEFAULT NULL,
      `register_id` int(11) DEFAULT NULL,
      `shift_start` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
      `shift_end` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
      `open_amount` decimal(23,10) NOT NULL,
      `close_amount` decimal(23,10) NOT NULL,
      `cash_sales_amount` decimal(23,10) NOT NULL,
      `total_cash_additions` decimal(23,10) NOT NULL DEFAULT '0.0000000000',
      `total_cash_subtractions` decimal(23,10) NOT NULL DEFAULT '0.0000000000',
      `notes` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
      `deleted` int(1) NOT NULL DEFAULT '0',
      PRIMARY KEY (`register_log_id`),
      KEY `phppos_register_log_ibfk_1` (`employee_id_open`),
      KEY `phppos_register_log_ibfk_2` (`register_id`),
      KEY `phppos_register_log_ibfk_3` (`employee_id_close`),
      CONSTRAINT `phppos_register_log_ibfk_1` FOREIGN KEY (`employee_id_open`) REFERENCES `phppos_employees` (`person_id`),
      CONSTRAINT `phppos_register_log_ibfk_2` FOREIGN KEY (`register_id`) REFERENCES `phppos_registers` (`register_id`),
      CONSTRAINT `phppos_register_log_ibfk_3` FOREIGN KEY (`employee_id_close`) REFERENCES `phppos_employees` (`person_id`)
    ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

Best Answer

since mysql 5.7, SQL_MODE default value is strict, please view this page: https://stackoverflow.com/questions/9192027/invalid-default-value-for-create-date-timestamp-field