View | Details | Raw Unified | Return to bug 11617
Collapse All | Expand All

(-)a/installer/data/mysql/kohastructure.sql (-1 / +2 lines)
Lines 3038-3044 CREATE TABLE `aqorders_items` ( -- information on items entered in the acquisiti Link Here
3038
  `timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP, -- the date and time this order item was last touched
3038
  `timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP, -- the date and time this order item was last touched
3039
  PRIMARY KEY  (`itemnumber`),
3039
  PRIMARY KEY  (`itemnumber`),
3040
  KEY `ordernumber` (`ordernumber`),
3040
  KEY `ordernumber` (`ordernumber`),
3041
  CONSTRAINT aqorders_items_ibfk_1 FOREIGN KEY (ordernumber) REFERENCES aqorders (ordernumber) ON DELETE CASCADE ON UPDATE CASCADE
3041
  CONSTRAINT aqorders_items_ibfk_1 FOREIGN KEY (ordernumber) REFERENCES aqorders (ordernumber) ON DELETE CASCADE ON UPDATE CASCADE,
3042
  CONSTRAINT aqorders_items_ibfk_2 FOREIGN KEY (itemnumber) REFERENCES items (itemnumber) ON DELETE CASCADE ON UPDATE CASCADE
3042
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
3043
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
3043
3044
3044
3045
(-)a/installer/data/mysql/updatedatabase.pl (-1 / +9 lines)
Lines 7945-7950 if (CheckVersion($DBversion)) { Link Here
7945
    SetVersion($DBversion);
7945
    SetVersion($DBversion);
7946
}
7946
}
7947
7947
7948
$DBversion = "3.15.00.XXX";
7949
if (CheckVersion($DBversion)) {
7950
    $dbh->do('delete aqorders_items from aqorders_items left join items it using (itemnumber) where it.itemnumber is null');
7951
    $dbh->do('alter table aqorders_items add constraint aqorders_items_ibfk_2 foreign key (itemnumber) references items (itemnumber) ON DELETE CASCADE ON UPDATE CASCADE');
7952
    print "Upgrade to $DBversion done (Bug 11617: Add itemnumber constraint to aqorders_items)\n";
7953
    SetVersion($DBversion);
7954
}
7955
7956
7948
=head1 FUNCTIONS
7957
=head1 FUNCTIONS
7949
7958
7950
=head2 TableExists($table)
7959
=head2 TableExists($table)
7951
- 

Return to bug 11617