Estou tentando alterar a engine de uma tabela de MyISAM
para InnoDB
, e ocorre que a coluna date_install
gera erros por conta de datas zeradas: 0000-00-00
.
No caso, utilizei a seguinte query:
update `glpidb`.`glpi_computers_softwareversions` set `date_install`='2019-01-01' where `date_install`='0000-00-00';
O erro que me é retornado é:
ERROR 1292 (22007): Incorrect date value: '0000-00-00' for column 'date_install' at row 1
Conforme informado anteriormente, também estou tentando passar a tabela para InnoDB.
Query de atualização para InnoDB
:
alter table `glpidb`.`glpi_computers_softwareversions` Engine=InnoDB;
*O erro que me ocorre ao executar a query de atualização para InnoDB
ERROR 1292 (22007): Incorrect date value: '0000-00-00' for column 'date_install' at row 5102
A estrutura da tabela é:
CREATE TABLE `glpi_computers_softwareversions` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`computers_id` int(11) NOT NULL DEFAULT '0',
`softwareversions_id` int(11) NOT NULL DEFAULT '0',
`is_deleted_computer` tinyint(1) NOT NULL DEFAULT '0',
`is_template_computer` tinyint(1) NOT NULL DEFAULT '0',
`entities_id` int(11) NOT NULL DEFAULT '0',
`is_deleted` tinyint(1) NOT NULL DEFAULT '0',
`is_dynamic` tinyint(1) NOT NULL DEFAULT '0',
`date_install` date DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `unicity` (`computers_id`,`softwareversions_id`),
KEY `softwareversions_id` (`softwareversions_id`),
KEY `computers_info` (`entities_id`,`is_template_computer`,`is_deleted_computer`),
KEY `is_template` (`is_template_computer`),
KEY `is_deleted` (`is_deleted_computer`),
KEY `is_dynamic` (`is_dynamic`),
KEY `date_install` (`date_install`)
) ENGINE=MyISAM AUTO_INCREMENT=2476336 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
Alguns registros para teste/reprodução do erro:
INSERT INTO `glpi_computers_softwareversions` VALUES (47629, 185, 6448, 0, 0, 18, 0, 1, '0000-00-00');
INSERT INTO `glpi_computers_softwareversions` VALUES (127367, 62, 14113, 0, 0, 18, 0, 1, '0000-00-00');
INSERT INTO `glpi_computers_softwareversions` VALUES (127366, 62, 14112, 0, 0, 18, 0, 1, '0000-00-00');
INSERT INTO `glpi_computers_softwareversions` VALUES (127393, 62, 14144, 0, 0, 18, 0, 1, '0000-00-00');
INSERT INTO `glpi_computers_softwareversions` VALUES (849215, 180, 14113, 0, 0, 18, 0, 1, '0000-00-00');
INSERT INTO `glpi_computers_softwareversions` VALUES (1907659, 367, 29433, 0, 0, 6, 0, 1, '0000-00-00');
INSERT INTO `glpi_computers_softwareversions` VALUES (1907658, 367, 29432, 0, 0, 6, 0, 1, '0000-00-00');
INSERT INTO `glpi_computers_softwareversions` VALUES (2475628, 34, 24352, 0, 0, 27, 0, 1, '2018-12-04');
INSERT INTO `glpi_computers_softwareversions` VALUES (2475624, 34, 26906, 0, 0, 27, 0, 1, '2018-12-12');
INSERT INTO `glpi_computers_softwareversions` VALUES (2475610, 34, 31514, 0, 0, 27, 0, 1, '2019-04-15');
INSERT INTO `glpi_computers_softwareversions` VALUES (2473876, 118, 12827, 0, 0, 16, 0, 1, '0000-00-00');
INSERT INTO `glpi_computers_softwareversions` VALUES (2475617, 34, 24283, 0, 0, 27, 0, 1, '2019-02-14');
INSERT INTO `glpi_computers_softwareversions` VALUES (2475009, 34, 18446, 0, 0, 27, 0, 1, '2018-03-06');
INSERT INTO `glpi_computers_softwareversions` VALUES (2473987, 34, 26589, 0, 0, 27, 0, 1, '2018-11-30');
INSERT INTO `glpi_computers_softwareversions` VALUES (2475001, 34, 18438, 0, 0, 27, 0, 1, '2018-03-06');
INSERT INTO `glpi_computers_softwareversions` VALUES (2475603, 34, 27965, 0, 0, 27, 0, 1, '2019-02-07');
INSERT INTO `glpi_computers_softwareversions` VALUES (2474994, 34, 18431, 0, 0, 27, 0, 1, '2018-03-06');
INSERT INTO `glpi_computers_softwareversions` VALUES (2475602, 34, 28292, 0, 0, 27, 0, 1, '2019-02-07');
INSERT INTO `glpi_computers_softwareversions` VALUES (2473821, 31, 5556, 0, 0, 21, 0, 1, '0000-00-00');
INSERT INTO `glpi_computers_softwareversions` VALUES (2475010, 34, 18447, 0, 0, 27, 0, 1, '2018-03-06');
INSERT INTO `glpi_computers_softwareversions` VALUES (2473687, 227, 31518, 0, 0, 16, 0, 1, '2019-04-16');
INSERT INTO `glpi_computers_softwareversions` VALUES (2473686, 227, 31517, 0, 0, 16, 0, 1, '2019-04-16');
INSERT INTO `glpi_computers_softwareversions` VALUES (2472637, 34, 18635, 0, 0, 27, 0, 1, NULL);
INSERT INTO `glpi_computers_softwareversions` VALUES (2475480, 25, 27617, 0, 0, 21, 0, 1, '2019-01-09');
INSERT INTO `glpi_computers_softwareversions` VALUES (2475479, 25, 27634, 0, 0, 21, 0, 1, '2019-01-09');
INSERT INTO `glpi_computers_softwareversions` VALUES (2475478, 25, 26592, 0, 0, 21, 0, 1, '2018-11-30');
INSERT INTO `glpi_computers_softwareversions` VALUES (2475477, 25, 28387, 0, 0, 21, 0, 1, '2019-02-07');
INSERT INTO `glpi_computers_softwareversions` VALUES (2475476, 25, 12202, 0, 0, 21, 0, 1, '2018-07-16');
INSERT INTO `glpi_computers_softwareversions` VALUES (2475006, 34, 18443, 0, 0, 27, 0, 1, '2018-03-06');
INSERT INTO `glpi_computers_softwareversions` VALUES (2475590, 34, 18421, 0, 0, 27, 0, 1, '2018-05-15');
INSERT INTO `glpi_computers_softwareversions` VALUES (2474993, 34, 18430, 0, 0, 27, 0, 1, '2018-03-06');