Remove itemstocknumber index and recreate it.
---
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 6888b72..261bf90 100755
--- a/installer/data/mysql/updatedatabase.pl
+++ b/installer/data/mysql/updatedatabase.pl
@@ -4074,6 +4074,20 @@ if (C4::Context->preference("Version") <
TransformToNum($DBversion)) {
SetVersion ($DBversion);
}
+$DBversion = '3.02.09.XXX';
+if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
+ #Follow up fix for 5860
+ #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 (non unique)
+ $dbh->do("ALTER TABLE items ADD INDEX itemstocknumberidx (stocknumber);");
+ print "Upgrade to $DBversion done (5860: Change items.stocknumber to be
not unique)\n";
+ SetVersion ($DBversion);
+}
+
=head1 FUNCTIONS
=head2 DropAllForeignKeys($table)
--
1.6.0.6
_______________________________________________
Koha-patches mailing list
[email protected]
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-patches
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/