From 193e9514e8d9c73cb064bc3b541439e618dcb872 Mon Sep 17 00:00:00 2001 From: Blou Date: Fri, 2 Sep 2016 08:05:48 -0400 Subject: [PATCH] Bug 17234 - updatedatabase.pl's ALTER IGNORE break with mysql 5.7.4+ The doc says: "As of MySQL 5.7.4, the IGNORE clause for ALTER TABLE is removed and its use produces an error." This fix replaces ALTER IGNORE with ALTER in updatedatabase.pl To TEST, try an upgrade from 3.18 to 3.22 after installing the latest mysql (at least 5.7.4, by the doc). Some will fail with error DBD::mysql::db do failed: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'IGNORE TABLE aqbasket ADD KEY authorisedby (authorisedby)' at line 1 [for Statement " ALTER IGNORE TABLE aqbasket ADD KEY authorisedby (authorisedby) "] at ./installer/data/mysql/updatedatabase.pl line 10563. 0) Find a database on 3.18, save it. 1) Set your code base to 3.22(or master) 2) run updatedatabase.pl 3) See the errors. 4) Apply the patch 5) Reload the 3.18 database 6) succeed with updatedatabase.pl Signed-off-by: Mark Tompsett --- installer/data/mysql/updatedatabase.pl | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl index 141d164..35c19b1 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -10421,13 +10421,13 @@ if ( CheckVersion($DBversion) ) { $DBversion = "3.19.00.041"; if ( CheckVersion($DBversion) ) { $dbh->do(q| - ALTER IGNORE TABLE suggestions ADD KEY status (STATUS) + ALTER TABLE suggestions ADD KEY status (STATUS) |); $dbh->do(q| - ALTER IGNORE TABLE suggestions ADD KEY biblionumber (biblionumber) + ALTER TABLE suggestions ADD KEY biblionumber (biblionumber) |); $dbh->do(q| - ALTER IGNORE TABLE suggestions ADD KEY branchcode (branchcode) + ALTER TABLE suggestions ADD KEY branchcode (branchcode) |); print "Upgrade to $DBversion done (Bug 14132: suggestions table is missing indexes)\n"; SetVersion ($DBversion); @@ -10443,7 +10443,7 @@ if ( CheckVersion($DBversion) ) { }); $dbh->do(q{ - ALTER IGNORE TABLE auth_subfield_structure + ALTER TABLE auth_subfield_structure ADD CONSTRAINT auth_subfield_structure_ibfk_1 FOREIGN KEY (authtypecode) REFERENCES auth_types(authtypecode) ON DELETE CASCADE ON UPDATE CASCADE @@ -10564,15 +10564,15 @@ if ( CheckVersion($DBversion) ) { $DBversion = "3.21.00.007"; if ( CheckVersion($DBversion) ) { $dbh->do(q| - ALTER IGNORE TABLE aqbasket + ALTER TABLE aqbasket ADD KEY authorisedby (authorisedby) |); $dbh->do(q| - ALTER IGNORE TABLE aqbooksellers + ALTER TABLE aqbooksellers ADD KEY name (name(255)) |); $dbh->do(q| - ALTER IGNORE TABLE aqbudgets + ALTER TABLE aqbudgets ADD KEY budget_parent_id (budget_parent_id), ADD KEY budget_code (budget_code), ADD KEY budget_branchcode (budget_branchcode), @@ -10580,11 +10580,11 @@ if ( CheckVersion($DBversion) ) { ADD KEY budget_owner_id (budget_owner_id) |); $dbh->do(q| - ALTER IGNORE TABLE aqbudgets_planning + ALTER TABLE aqbudgets_planning ADD KEY budget_period_id (budget_period_id) |); $dbh->do(q| - ALTER IGNORE TABLE aqorders + ALTER TABLE aqorders ADD KEY parent_ordernumber (parent_ordernumber), ADD KEY orderstatus (orderstatus) |); @@ -10821,7 +10821,7 @@ if ( CheckVersion($DBversion) ) { $dbh->{PrintError} = $print_error; $dbh->do(q{ - ALTER IGNORE TABLE course_reserves + ALTER TABLE course_reserves ADD CONSTRAINT course_reserves_ibfk_2 FOREIGN KEY (ci_id) REFERENCES course_items (ci_id) ON DELETE CASCADE ON UPDATE CASCADE @@ -10934,7 +10934,7 @@ if ( CheckVersion($DBversion) ) { $DBversion = "3.21.00.029"; if ( CheckVersion($DBversion) ) { $dbh->do(q{ - ALTER IGNORE TABLE discharges + ALTER TABLE discharges ADD COLUMN discharge_id int(11) NOT NULL AUTO_INCREMENT PRIMARY KEY FIRST }); print "Upgrade to $DBversion done (Bug 14368: Add discharges history)\n"; -- 2.7.4