From 434f06149f40fa7f3ad6f01eeec00754a656225d Mon Sep 17 00:00:00 2001 From: Paul POULAIN Date: Wed, 30 Jul 2008 17:03:05 +0200 Subject: [PATCH] BUGFIX fix on 2380 fix, dump to 102 Signed-off-by: Joshua Ferraro --- installer/data/mysql/updatedatabase.pl | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl index 989b0ed973..43e0ef1af9 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -1884,8 +1884,10 @@ if ( C4::Context->preference('Version') < TransformToNum($DBversion) ) { $dbh->do('ALTER TABLE serialitems MODIFY `serialid` int(11) NOT NULL AFTER itemnumber' ); $dbh->do('ALTER TABLE serialitems DROP KEY serialididx' ); $dbh->do('ALTER TABLE serialitems ADD CONSTRAINT UNIQUE KEY serialitemsidx (itemnumber)' ); + # before setting constraint, delete any unvalid data + $dbh->do('DELETE from serialitems WHERE serialid not in (SELECT serial.serialid FROM serial)'); $dbh->do('ALTER TABLE serialitems ADD CONSTRAINT serialitems_sfk_1 FOREIGN KEY (serialid) REFERENCES serial (serialid) ON DELETE CASCADE ON UPDATE CASCADE' ); - print "Upgrade to $DBversion done (Updating serialitems table to allow for mulitple items per serial fixing kohabug 2380)\n"; + print "Upgrade to $DBversion done (Updating serialitems table to allow for multiple items per serial fixing kohabug 2380)\n"; SetVersion($DBversion); } -- 2.39.5