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 6020-6025 if (C4::Context->preference("Version") < TransformToNum($DBversion)) { Link Here
6020
   SetVersion ($DBversion);
6020
   SetVersion ($DBversion);
6021
}
6021
}
6022
6022
6023
$DBversion = "3.09.00.XXX";
6024
if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
6025
    $dbh->do(q{
6026
        DELETE from aqorders_items where ordernumber NOT IN (SELECT ordernumber FROM aqorders);
6027
    });
6028
    $dbh->do(q{
6029
        ALTER TABLE aqorders_items
6030
        ADD CONSTRAINT aqorders_items_ibfk_1 FOREIGN KEY (ordernumber) REFERENCES aqorders (ordernumber)
6031
        ON DELETE CASCADE ON UPDATE CASCADE;
6032
    });
6033
    print "Upgrade to $DBversion done (Bug 9030: Add constraint on aqorders_items.ordernumber)\n";
6034
    SetVersion ($DBversion);
6035
}
6036
6023
=head1 FUNCTIONS
6037
=head1 FUNCTIONS
6024
6038
6025
=head2 TableExists($table)
6039
=head2 TableExists($table)
6026
- 

Return to bug 9030