Bug 4972 Fix table creations failing due to foreign key checks
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 Signed-off-by: Galen Charlton <gmcharlt@gmail.com>
This commit is contained in:
parent
dcbcf8815c
commit
a0065707d8
1 changed files with 4 additions and 0 deletions
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue