Skip to content

Instantly share code, notes, and snippets.

@ranginui ranginui/gist:927131
Created Apr 19, 2011

What would you like to do?
$DBversion = '';
if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
my $sth = $dbh->prepare("SHOW INDEX FROM items WHERE KEY_NAME = 'itemsstocknumberidx'");
if (my $index = $sth->fetchrow_hashref()){
$dbh->do("ALTER TABLE `items` DROP INDEX `itemsstocknumberidx`;");
else {
dbh->do("ALTER TABLE `items` DROP INDEX `itemstocknumberidx`;");
$dbh->do("ALTER TABLE items ADD INDEX itemstocknumberidx (stocknumber);");
print "Upgrade to $DBversion done (Change items.stocknumber to be not unique)\n";
SetVersion ($DBversion);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.