column was added in two separate updates

3.01.00.068 duplicates the operations of 3.01.00.065
Because one column has already been created, populated and dropped
the rest of the update fails
This commit is contained in:
Colin Campbell 2010-01-22 15:33:13 +00:00
parent 9e42d04cb7
commit 87a3a627f1

View file

@ -2758,17 +2758,9 @@ $DBversion = "3.01.00.068";
if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
$dbh->do("ALTER TABLE issuingrules ADD
COLUMN `finedays` int(11) default NULL AFTER `fine`,
ADD COLUMN `renewalsallowed` smallint(6) default NULL,
ADD COLUMN `reservesallowed` smallint(6) default NULL;
");
my $sth = $dbh->prepare("SELECT itemtype, renewalsallowed FROM itemtypes");
$sth->execute();
my $sthupd = $dbh->prepare("UPDATE issuingrules SET renewalsallowed = ? WHERE itemtype = ?");
while(my $row = $sth->fetchrow_hashref){
$sthupd->execute($row->{renewalsallowed}, $row->{itemtype});
}
$dbh->do('ALTER TABLE itemtypes DROP COLUMN `renewalsallowed`;');
print "Upgrade done (Adding finedays renewalsallowed, and reservesallowed fields in issuingrules table)\n";
print "Upgrade done (Adding finedays and reservesallowed fields in issuingrules table)\n";
}