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

(-)a/installer/data/mysql/updatedatabase.pl (-2 / +8 lines)
Lines 4217-4223 if (C4::Context->preference("Version") < TransformToNum($DBversion)) { Link Here
4217
4217
4218
$DBversion = '3.03.00.042';
4218
$DBversion = '3.03.00.042';
4219
if (C4::Context->preference("Version") < TransformToNum($DBversion) && $original_version < TransformToNum("3.02.06.001")) {
4219
if (C4::Context->preference("Version") < TransformToNum($DBversion) && $original_version < TransformToNum("3.02.06.001")) {
4220
    $dbh->do("ALTER TABLE `items` DROP INDEX `itemsstocknumberidx`;");
4220
    my $sth = $dbh->prepare("SELECT index_name FROM information_schema.statistics  WHERE index_name ='itemsstocknumberidx'");
4221
    $sth->execute();
4222
    if (my $rows = $sth->fetchrows_hashref()){
4223
	$dbh->do("ALTER TABLE `items` DROP INDEX `itemsstocknumberidx`;");
4224
    }
4225
    else {
4226
    	$dbh->do("ALTER TABLE `items` DROP INDEX `itemstocknumberidx`;");
4227
    }
4221
    $dbh->do("ALTER TABLE items ADD INDEX itemstocknumberidx (stocknumber);");
4228
    $dbh->do("ALTER TABLE items ADD INDEX itemstocknumberidx (stocknumber);");
4222
    print "Upgrade to $DBversion done (Change items.stocknumber to be not unique)\n";
4229
    print "Upgrade to $DBversion done (Change items.stocknumber to be not unique)\n";
4223
    SetVersion ($DBversion);
4230
    SetVersion ($DBversion);
4224
- 

Return to bug 5860