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 4323-4328
if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
Link Here
|
4323 |
SetVersion ($DBversion); |
4337 |
SetVersion ($DBversion); |
4324 |
} |
4338 |
} |
4325 |
|
4339 |
|
|
|
4340 |
$DBversion = '3.04.00.XXX'; |
4341 |
if (C4::Context->preference("Version") < TransformToNum($DBversion)) { |
4342 |
#follow up fix 5860: some installs already past 3.3.0.42 |
4343 |
stocknumber_checker(); |
4344 |
print "Upgrade to $DBversion done (Fix for stocknumber index)\n"; |
4345 |
SetVersion ($DBversion); |
4346 |
} |
4326 |
|
4347 |
|
4327 |
=head1 FUNCTIONS |
4348 |
=head1 FUNCTIONS |
4328 |
|
4349 |
|
4329 |
- |
|
|