Hi all,

 

In order to test such changes, I normally make an edit like:

 

$DBversion = "3.05.00.xxx";

if (1||C4::Context->preference("Version") < TransformToNum($DBversion)) {

    $dbh->do("UPDATE marc_subfield_structure SET kohafield = NULL WHERE tagfield = 952 AND tagsubfield = 'f' AND kohafield = 'items.coded_location_qualifier'");

    print "Upgrade to $DBversion done (remove non-existant 'items.coded_location_qualifier' column)\n";

    #SetVersion($DBversion);

}

 

Note the 1 in the if and the # before SetVersion. This prevents an error on the wrong comparison (string comparison is: lt) and also an XXX in my Koha testversion.

 

I suppose that not everybody makes such changes and therefore some updatedatabase changes are not tested well ?? (I just had one at hand while signing off.)

 

In patch 6536 I included the following lines to eliminate such changes for testing:

 

@@ -4396,6 +4408,10 @@ sub TransformToNum {

     my $version = shift;

     # remove the 3 last . to have a Perl number

     $version =~ s/(.*\..*)\.(.*)\.(.*)/$1$2$3/;

+    # three X's at the end indicate that you are testing patch with dbrev

+    # change it into 999

+    # prevents error on a < comparison between strings (should be: lt)

+    $version =~ s/XXX$/999/;

     return $version;

 }

 

sub SetVersion {

-    my $kohaversion = TransformToNum(shift);

+    return if $_[0]=~ /XXX$/;

+      #you are testing a patch with a db revision; do not change version

+    my $kohaversion = TransformToNum($_[0]);

     if (C4::Context->preference('Version')) {

       my $finish=$dbh->prepare("UPDATE systempreferences SET value=? WHERE variable='Version'");

       $finish->execute($kohaversion);

 

 

My question is: Does anybody object to submitting this change as a separate patch in order to facilitate db rev testing?  I think it is an advantage to leave the version as is when you are only testing the db rev.

 

 

Thanks,

Marcel