From 2e5c2a8201566f9d2df42e77a58c82505b3e77dd 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 Signed-off-by: Mark Tompsett Signed-off-by: Kyle M Hall (cherry picked from commit acf425bbbcb8c22f3655472f90285869c3ad7164) Signed-off-by: Katrin Fischer (cherry picked from commit e2e61a798cd9e07dfdb4026b1ab455f1a07cd301) Signed-off-by: Julian Maurice --- 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 cce7e01bc4..75e915ac64 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -10418,13 +10418,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); @@ -10440,7 +10440,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 @@ -10561,15 +10561,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), @@ -10577,11 +10577,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) |); @@ -10818,7 +10818,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 @@ -10931,7 +10931,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.39.5