Bug 24722: DBRev 19.12.00.041
authorMartin Renvoize <martin.renvoize@ptfs-europe.com>
Wed, 18 Mar 2020 08:34:21 +0000 (08:34 +0000)
committerMartin Renvoize <martin.renvoize@ptfs-europe.com>
Wed, 18 Mar 2020 08:40:07 +0000 (08:40 +0000)
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Koha.pm
Koha/Schema/Result/OldReserve.pm
installer/data/mysql/atomicupdate/bug_24722.perl [deleted file]
installer/data/mysql/updatedatabase.pl

diff --git a/Koha.pm b/Koha.pm
index 7569ed1..9b62ff4 100644 (file)
--- a/Koha.pm
+++ b/Koha.pm
@@ -29,7 +29,7 @@ use vars qw{ $VERSION };
 # - #4 : the developer version. The 4th number is the database subversion.
 #        used by developers when the database changes. updatedatabase take care of the changes itself
 #        and is automatically called by Auth.pm when needed.
-$VERSION = "19.12.00.040";
+$VERSION = "19.12.00.041";
 
 sub version {
     return $VERSION;
index de9fc6c..eb9033d 100644 (file)
@@ -78,7 +78,7 @@ __PACKAGE__->table("old_reserves");
 =head2 priority
 
   data_type: 'smallint'
-  is_nullable: 1
+  is_nullable: 0
 
 =head2 found
 
@@ -165,7 +165,7 @@ __PACKAGE__->add_columns(
   "reservenotes",
   { data_type => "longtext", is_nullable => 1 },
   "priority",
-  { data_type => "smallint", is_nullable => 1 },
+  { data_type => "smallint", is_nullable => 0 },
   "found",
   { data_type => "varchar", is_nullable => 1, size => 1 },
   "timestamp",
@@ -297,8 +297,8 @@ __PACKAGE__->belongs_to(
 );
 
 
-# Created by DBIx::Class::Schema::Loader v0.07046 @ 2019-06-17 07:24:39
-# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:ZgGAW7ODBby3hGNJ41eeMA
+# Created by DBIx::Class::Schema::Loader v0.07046 @ 2020-03-18 08:36:19
+# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:RDZP4TEaFZUexg9jVg6DbA
 
 sub koha_object_class {
     'Koha::Old::Hold';
diff --git a/installer/data/mysql/atomicupdate/bug_24722.perl b/installer/data/mysql/atomicupdate/bug_24722.perl
deleted file mode 100644 (file)
index 669c96a..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-$DBversion = 'XXX'; # will be replaced by the RM
-if( CheckVersion( $DBversion ) ) {
-    $dbh->do(q|
-        ALTER TABLE reserves MODIFY priority SMALLINT(6) NOT NULL
-    |);
-
-    $dbh->do(q|
-        ALTER TABLE old_reserves MODIFY priority SMALLINT(6) NOT NULL
-    |);
-
-    SetVersion( $DBversion );
-    print "Upgrade to $DBversion done (Bug 24722 - Enforce NOT NULL constraint for reserves.priority)\n";
-}
index 26c2542..a26f409 100755 (executable)
@@ -21100,6 +21100,30 @@ if( CheckVersion( $DBversion ) ) {
     print "Upgrade to $DBversion done (Bug 17374 - update description of DefaultPatronSearchFields)\n";
 }
 
+$DBversion = '19.12.00.041';
+if( CheckVersion( $DBversion ) ) {
+
+    # Update existing NULL priorities
+    $dbh->do(q|
+        UPDATE reserves SET priority = 0 WHERE priority IS NULL
+    |);
+
+    $dbh->do(q|
+        ALTER TABLE reserves MODIFY priority SMALLINT(6) NOT NULL
+    |);
+
+    $dbh->do(q|
+        UPDATE old_reserves SET priority = 0 WHERE priority IS NULL
+    |);
+
+    $dbh->do(q|
+        ALTER TABLE old_reserves MODIFY priority SMALLINT(6) NOT NULL
+    |);
+
+    SetVersion( $DBversion );
+    print "Upgrade to $DBversion done (Bug 24722 - Enforce NOT NULL constraint for reserves.priority)\n";
+}
+
 # SEE bug 13068
 # if there is anything in the atomicupdate, read and execute it.
 my $update_dir = C4::Context->config('intranetdir') . '/installer/data/mysql/atomicupdate/';