Lines 4216-4228
if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
Link Here
|
4216 |
} |
4216 |
} |
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)) { |
4220 |
$dbh->do("ALTER TABLE `items` DROP INDEX `itemsstocknumberidx`;"); |
4220 |
stocknumber_checker(); |
4221 |
$dbh->do("ALTER TABLE items ADD INDEX itemstocknumberidx (stocknumber);"); |
4221 |
print "Upgrade to $DBversion done (5860 Index itemstocknumber)\n"; |
4222 |
print "Upgrade to $DBversion done (Change items.stocknumber to be not unique)\n"; |
|
|
4223 |
SetVersion ($DBversion); |
4222 |
SetVersion ($DBversion); |
4224 |
} |
4223 |
} |
4225 |
|
4224 |
|
|
|
4225 |
sub stocknumber_checker { #code reused later on |
4226 |
my @row; |
4227 |
#drop the obsolete itemSStocknumber idx if it exists |
4228 |
@row = $dbh->selectrow_array("SHOW INDEXES FROM items WHERE key_name='itemsstocknumberidx'"); |
4229 |
$dbh->do("ALTER TABLE `items` DROP INDEX `itemsstocknumberidx`;") if @row; |
4230 |
|
4231 |
#check itemstocknumber idx; remove it if it is unique |
4232 |
@row = $dbh->selectrow_array("SHOW INDEXES FROM items WHERE key_name='itemstocknumberidx' AND non_unique=0"); |
4233 |
$dbh->do("ALTER TABLE `items` DROP INDEX `itemstocknumberidx`;") if @row; |
4234 |
|
4235 |
#add itemstocknumber index non-unique IF it still not exists |
4236 |
@row = $dbh->selectrow_array("SHOW INDEXES FROM items WHERE key_name='itemstocknumberidx'"); |
4237 |
$dbh->do("ALTER TABLE items ADD INDEX itemstocknumberidx (stocknumber);") unless @row; |
4238 |
} |
4239 |
|
4226 |
$DBversion = "3.03.00.043"; |
4240 |
$DBversion = "3.03.00.043"; |
4227 |
if (C4::Context->preference("Version") < TransformToNum($DBversion)) { |
4241 |
if (C4::Context->preference("Version") < TransformToNum($DBversion)) { |
4228 |
|
4242 |
|
Lines 4332-4337
if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) {
Link Here
|
4332 |
SetVersion($DBversion); |
4346 |
SetVersion($DBversion); |
4333 |
} |
4347 |
} |
4334 |
|
4348 |
|
|
|
4349 |
$DBversion = '3.05.00.XXX'; |
4350 |
if (C4::Context->preference("Version") < TransformToNum($DBversion)) { |
4351 |
#follow up fix 5860: some installs already past 3.3.0.42 |
4352 |
stocknumber_checker(); |
4353 |
print "Upgrade to $DBversion done (Fix for stocknumber index)\n"; |
4354 |
SetVersion ($DBversion); |
4355 |
} |
4356 |
|
4335 |
=head1 FUNCTIONS |
4357 |
=head1 FUNCTIONS |
4336 |
|
4358 |
|
4337 |
=head2 DropAllForeignKeys($table) |
4359 |
=head2 DropAllForeignKeys($table) |
4338 |
- |
|
|