From 8fd578800eb104b104e98c9dc7be1ed8a79bf2cc Mon Sep 17 00:00:00 2001 From: Paul Poulain Date: Fri, 6 Jan 2012 10:50:48 +0100 Subject: [PATCH] follow-up: fixing mistake in database revision number After long discussion with chris_c (previous RM) and chris_n (previous and actual RMaint), it appears I should not have used 3.06 chris_n will duplicate this entry if it's needed to port this patch onto master. I renumber the version to 3.07 I also have found in my testings that there is a problem if this DBrev is run twice (once in 3.6 and once in 3.8) All patrons that are temporarily suspended (ie: have a date in debarred) will become suspended forever The test was just made on debarred<>0, it's OK if we come from a 3.4, as debarred is a tinyint used as a boolean. But if we already have a date, it won't do what we want. I switched to a =1 instead of <>0, that fixes the problem --- installer/data/mysql/updatedatabase.pl | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl index 9ae0060f7a..e901a58534 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -4551,9 +4551,9 @@ if (C4::Context->preference("Version") < TransformToNum($DBversion)) { SetVersion ($DBversion); } -$DBversion = "3.06.00.001"; +$DBversion = "3.07.00.001"; if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) { - my $borrowers = $dbh->selectcol_arrayref( "SELECT borrowernumber from borrowers where debarred <>0;", { Columns => [1] } ); + my $borrowers = $dbh->selectcol_arrayref( "SELECT borrowernumber from borrowers where debarred =1;", { Columns => [1] } ); $dbh->do("ALTER TABLE borrowers MODIFY debarred DATE DEFAULT NULL;"); $dbh->do( "UPDATE borrowers set debarred='9999-12-31' where borrowernumber IN (" . join( ",", @$borrowers ) . ");" ) if ($borrowers and scalar(@$borrowers)>0); $dbh->do("ALTER TABLE borrowers ADD COLUMN debarredcomment VARCHAR(255) DEFAULT NULL AFTER debarred;"); @@ -4564,7 +4564,7 @@ if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) { SetVersion($DBversion); } -$DBversion = "3.06.00.002"; +$DBversion = "3.07.00.002"; if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) { $dbh->do("UPDATE borrowers SET debarred=NULL WHERE debarred='0000-00-00';"); print "Setting NULL to debarred where 0000-00-00 is stored (bug 7272)"; -- 2.39.5