You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Database migration fails on the log_link_visit_action table if MySQL is configured with options in "STRICT_TRANS_TABLES, STRICT_ALL_TABLES, NO_ZERO_IN_DATE, NO_ZERO_DATE"
Details
Steps to Reproduce
Create the log_link_visit_action table from 1.1.1:
CREATE TABLE IF NOT EXISTS "piwik_log_link_visit_action" (
"idlink_va" int(11) NOT NULL AUTO_INCREMENT,
"idvisit" int(10) unsigned NOT NULL,
"idaction_url" int(10) unsigned NOT NULL,
"idaction_url_ref" int(10) unsigned NOT NULL,
"idaction_name" int(10) unsigned DEFAULT NULL,
"time_spent_ref_action" int(10) unsigned NOT NULL,
PRIMARY KEY ("idlink_va"),
KEY "index_idvisit" ("idvisit")
);
Run the ALTER command that will update that table to 1.2.1:
ALTER TABLE `piwik_log_link_visit_action`
ADD `idsite` INT( 10 ) UNSIGNED NOT NULL AFTER `idlink_va` ,
ADD `server_time` DATETIME NOT NULL AFTER `idsite`,
ADD `idvisitor` BINARY(8) NOT NULL AFTER `idsite`,
ADD `idaction_name_ref` INT UNSIGNED NOT NULL AFTER `idaction_name`,
ADD INDEX `index_idsite_servertime` ( `idsite` , `server_time` )
Expect to See
No errors, successful migration.
Actually Saw
Error message and upgrade aborted with tables in half-converted state:
"SQL Error (1292): Incorrect datetime value: '0000-00-00 00:00:00' for column 'server_time' at row 1"
Possible Solution
Let the column server_time be NULL.
MySQL details
The STRICT_ settings in MySQL disallow invalid date values to be entered. The NO_ZERO_ settings prevent dates in the form of 0000:00:00 00:00:00 from being in the table.
Versions of MySQL this appears on: 5.1.39 and 5.1.53
The text was updated successfully, but these errors were encountered:
I guess this is an inconsistency in MySQL, but despite sql_mode='STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE', this filled the server_time column with '0000-00-00 00:00:00':
ALTER TABLE `piwik_log_link_visit_action` ADD `server_time` DATETIME NOT NULL AFTER `idsite`;
ALTER IGNORE TABLE `piwik_log_link_visit_action` CHANGE `server_time` `server_time` DATETIME NOT NULL;
Summary
Database migration fails on the log_link_visit_action table if MySQL is configured with options in "STRICT_TRANS_TABLES, STRICT_ALL_TABLES, NO_ZERO_IN_DATE, NO_ZERO_DATE"
Details
Steps to Reproduce
Create the
log_link_visit_action
table from 1.1.1:Populate it with a few sample values:
Run the
ALTE
R command that will update that table to 1.2.1:Expect to See
No errors, successful migration.
Actually Saw
Error message and upgrade aborted with tables in half-converted state:
"SQL Error (1292): Incorrect datetime value: '0000-00-00 00:00:00' for column 'server_time' at row 1"
Possible Solution
Let the column
server_time
be NULL.MySQL details
The
STRICT_
settings in MySQL disallow invalid date values to be entered. TheNO_ZERO_
settings prevent dates in the form of0000:00:00 00:00:00
from being in the table.Versions of MySQL this appears on: 5.1.39 and 5.1.53
The text was updated successfully, but these errors were encountered: