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

(-)a/installer/data/mysql/kohastructure.sql (-1 / +2 lines)
Lines 2822-2828 CREATE TABLE `aqorders_items` ( -- information on items entered in the acquisiti Link Here
2822
  `itemnumber` int(11) NOT NULL, -- the item number for this item (items.itemnumber)
2822
  `itemnumber` int(11) NOT NULL, -- the item number for this item (items.itemnumber)
2823
  `timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP, -- the date and time this order item was last touched
2823
  `timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP, -- the date and time this order item was last touched
2824
  PRIMARY KEY  (`itemnumber`),
2824
  PRIMARY KEY  (`itemnumber`),
2825
  KEY `ordernumber` (`ordernumber`)
2825
  KEY `ordernumber` (`ordernumber`),
2826
  CONSTRAINT aqorders_items_ibfk_1 FOREIGN KEY (ordernumber) REFERENCES aqorders (ordernumber) ON DELETE CASCADE ON UPDATE CASCADE
2826
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
2827
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
2827
2828
2828
2829
(-)a/installer/data/mysql/updatedatabase.pl (-1 / +14 lines)
Lines 6041-6046 if (C4::Context->preference("Version") < TransformToNum($DBversion)) { Link Here
6041
    SetVersion ($DBversion);
6041
    SetVersion ($DBversion);
6042
}
6042
}
6043
6043
6044
$DBversion = "3.09.00.XXX";
6045
if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
6046
    $dbh->do(q{
6047
        DELETE from aqorders_items where ordernumber NOT IN (SELECT ordernumber FROM aqorders);
6048
    });
6049
    $dbh->do(q{
6050
        ALTER TABLE aqorders_items
6051
        ADD CONSTRAINT aqorders_items_ibfk_1 FOREIGN KEY (ordernumber) REFERENCES aqorders (ordernumber)
6052
        ON DELETE CASCADE ON UPDATE CASCADE;
6053
    });
6054
    print "Upgrade to $DBversion done (Bug 9030: Add constraint on aqorders_items.ordernumber)\n";
6055
    SetVersion ($DBversion);
6056
}
6057
6044
=head1 FUNCTIONS
6058
=head1 FUNCTIONS
6045
6059
6046
=head2 TableExists($table)
6060
=head2 TableExists($table)
6047
- 

Return to bug 9030