From 374c78a0b7039c5c18143c93fbd49e9376af5666 Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Wed, 18 Mar 2020 08:34:21 +0000 Subject: [PATCH] Bug 24722: DBRev 19.12.00.041 Signed-off-by: Martin Renvoize --- Koha.pm | 2 +- Koha/Schema/Result/OldReserve.pm | 8 +++---- .../data/mysql/atomicupdate/bug_24722.perl | 13 ---------- installer/data/mysql/updatedatabase.pl | 24 +++++++++++++++++++ 4 files changed, 29 insertions(+), 18 deletions(-) delete mode 100644 installer/data/mysql/atomicupdate/bug_24722.perl diff --git a/Koha.pm b/Koha.pm index 7569ed1ff3..9b62ff4951 100644 --- 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; diff --git a/Koha/Schema/Result/OldReserve.pm b/Koha/Schema/Result/OldReserve.pm index de9fc6cb27..eb9033d06a 100644 --- a/Koha/Schema/Result/OldReserve.pm +++ b/Koha/Schema/Result/OldReserve.pm @@ -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 index 669c96a109..0000000000 --- a/installer/data/mysql/atomicupdate/bug_24722.perl +++ /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"; -} diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl index 26c254206d..a26f409609 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -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/'; -- 2.39.5