[Koha-patches] [PATCH] Second follow up fix for 5860
Marcel de Rooy
M.de.Rooy at rijksmuseum.nl
Mon May 16 10:07:49 CEST 2011
Added code also at end of updatedatabase. Some installs may need it.
Since it only may recreate the index, it does not harm...
NOTE: Please apply after first follow up fix!
---
installer/data/mysql/updatedatabase.pl | 14 ++++++++++++++
1 files changed, 14 insertions(+), 0 deletions(-)
diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl
index 1de273e..d7bd5a3 100755
--- a/installer/data/mysql/updatedatabase.pl
+++ b/installer/data/mysql/updatedatabase.pl
@@ -4337,6 +4337,20 @@ if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) {
SetVersion($DBversion);
}
+$DBversion = '3.05.00.XXX';
+if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
+ #follow up fix 5860: some installs already past 3.3.0.42
+ #check old indexes and possibly remove
+ my @row = $dbh->selectrow_array("SHOW INDEXES FROM items WHERE key_name='itemstocknumberidx'");
+ $dbh->do("ALTER TABLE `items` DROP INDEX `itemstocknumberidx`;") if @row;
+ @row = $dbh->selectrow_array("SHOW INDEXES FROM items WHERE key_name='itemsstocknumberidx'");
+ $dbh->do("ALTER TABLE `items` DROP INDEX `itemsstocknumberidx`;") if @row;
+ #add index
+ $dbh->do("ALTER TABLE items ADD INDEX itemstocknumberidx (stocknumber);");
+ print "Upgrade to $DBversion done (Change items.stocknumber to be not unique)\n";
+ SetVersion ($DBversion);
+}
+
=head1 FUNCTIONS
=head2 DropAllForeignKeys($table)
--
1.6.0.6
More information about the Koha-patches
mailing list