Bugzilla – Attachment 2331 Details for
Bug 4972
updatedatebase fails to create aqbasketgroups and aqcontract
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Proposed Patch
0001-Bug-4972-Fix-table-creations-failing-due-to-foreign-.patch (text/plain), 2.52 KB, created by
Colin Campbell
on 2010-07-08 15:20:12 UTC
(
hide
)
Description:
Proposed Patch
Filename:
MIME Type:
Creator:
Colin Campbell
Created:
2010-07-08 15:20:12 UTC
Size:
2.52 KB
patch
obsolete
>From 5f2783cfbd919b7f6d8790e682a8f3da070952bc Mon Sep 17 00:00:00 2001 >From: Colin Campbell <colin.campbell@ptfs-europe.com> >Date: Thu, 8 Jul 2010 16:14:58 +0100 >Subject: [PATCH] Bug 4972 Fix table creations failing due to foreign key checks >Content-Type: text/plain; charset="utf-8" > >create tables were failing with cryptic 1005 error from mysql >wrapped creation of aqbasketgroups and aqcontract in >FOREIGN_KEY_CHECKS=0 and FOREIGN_KEY_CHECKS=1 >--- > installer/data/mysql/updatedatabase.pl | 4 ++++ > 1 files changed, 4 insertions(+), 0 deletions(-) > >diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl >index 68e7cbc..53edfbf 100755 >--- a/installer/data/mysql/updatedatabase.pl >+++ b/installer/data/mysql/updatedatabase.pl >@@ -2818,6 +2818,7 @@ if (C4::Context->preference("Version") < TransformToNum($DBversion)) { > > $DBversion = '3.01.00.073'; > if (C4::Context->preference("Version") < TransformToNum($DBversion)) { >+ $dbh->do('SET FOREIGN_KEY_CHECKS=0 '); > $dbh->do(<<'END_SQL'); > CREATE TABLE IF NOT EXISTS `aqcontract` ( > `contractnumber` int(11) NOT NULL auto_increment, >@@ -2831,6 +2832,7 @@ CREATE TABLE IF NOT EXISTS `aqcontract` ( > REFERENCES `aqbooksellers` (`id`) ON DELETE CASCADE ON UPDATE CASCADE > ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; > END_SQL >+ $dbh->do('SET FOREIGN_KEY_CHECKS=1 '); > print "Upgrade to $DBversion done (adding aqcontract table)\n"; > SetVersion ($DBversion); > } >@@ -2856,6 +2858,7 @@ if (C4::Context->preference("Version") < TransformToNum($DBversion)) { > > $DBversion = '3.01.00.076'; > if (C4::Context->preference("Version") < TransformToNum($DBversion)) { >+ $dbh->do('SET FOREIGN_KEY_CHECKS=0 '); > $dbh->do("CREATE TABLE IF NOT EXISTS `aqbasketgroups` ( > `id` int(11) NOT NULL auto_increment, > `name` varchar(50) default NULL, >@@ -2868,6 +2871,7 @@ if (C4::Context->preference("Version") < TransformToNum($DBversion)) { > $dbh->do("ALTER TABLE aqbasket ADD COLUMN `basketgroupid` int(11)"); > $dbh->do("ALTER TABLE aqbasket ADD FOREIGN KEY (`basketgroupid`) REFERENCES `aqbasketgroups` (`id`) ON UPDATE CASCADE ON DELETE SET NULL"); > $dbh->do("INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES ('pdfformat','pdfformat::layout2pages','Controls what script is used for printing (basketgroups)','','free')"); >+ $dbh->do('SET FOREIGN_KEY_CHECKS=1 '); > print "Upgrade to $DBversion done (adding basketgroups)\n"; > SetVersion ($DBversion); > } >-- >1.7.1 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 4972
: 2331