BEARBEITEN: Wenn Sie eine vorhandene Datenbank von MySQL 5.6 aktualisieren und ausführen:
UPDATE phppos_register_log SET shift_end = '2015-01-01 00:00:00' WHERE shift_end = '0000-00-00 00:00:00';
Dies erzeugt:
#1292 - Incorrect datetime value: '0000-00-00 00:00:00' for column 'shift_end' at row 1
#1067 - Invalid default value for 'shift_start'
Dies funktionierte in MySQL <= 5.7. Ich konnte keine Dokumentation dazu finden ... Was ist das Problem damit?
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;
NO_ZERO_DATE
, was jetzt Teil der Standardkonfiguration ist. Kannst du bestätigen? Bitte SELECT @@SQL_MODE;
.