From d1fbd8b3c63b136b1a98edd9babc7d9aa0287c1c Mon Sep 17 00:00:00 2001 From: Tomas Cohen Arazi Date: Thu, 23 Jun 2022 12:00:36 -0300 Subject: [PATCH] Bug 12446: DBRev 22.06.00.004 Signed-off-by: Tomas Cohen Arazi --- Koha.pm | 2 +- .../data/mysql/atomicupdate/bug_12446.perl | 10 -------- installer/data/mysql/db_revs/220600004.pl | 23 +++++++++++++++++++ 3 files changed, 24 insertions(+), 11 deletions(-) delete mode 100644 installer/data/mysql/atomicupdate/bug_12446.perl create mode 100755 installer/data/mysql/db_revs/220600004.pl diff --git a/Koha.pm b/Koha.pm index 1c94911cd0..9fe9bd5fc3 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 = "22.06.00.003"; +$VERSION = "22.06.00.004"; sub version { return $VERSION; diff --git a/installer/data/mysql/atomicupdate/bug_12446.perl b/installer/data/mysql/atomicupdate/bug_12446.perl deleted file mode 100644 index 9f9e4e5160..0000000000 --- a/installer/data/mysql/atomicupdate/bug_12446.perl +++ /dev/null @@ -1,10 +0,0 @@ -$DBversion = 'XXX'; # will be replaced by the RM -if( CheckVersion( $DBversion ) ) { - if ( !column_exists( 'categories', 'canbeguarantee') ){ - $dbh->do("ALTER TABLE categories ADD COLUMN `canbeguarantee` tinyint(1) NOT NULL default '0' AFTER `checkprevcheckout`"); - $dbh->do("UPDATE categories SET canbeguarantee = 1 WHERE category_type = 'P' OR category_type = 'C'"); - } - - SetVersion( $DBversion ); - print "Upgrade to $DBversion done (Bug 12446 - Ability to allow guarantor relationship for all patron category types)\n"; -} \ No newline at end of file diff --git a/installer/data/mysql/db_revs/220600004.pl b/installer/data/mysql/db_revs/220600004.pl new file mode 100755 index 0000000000..eab9269c0e --- /dev/null +++ b/installer/data/mysql/db_revs/220600004.pl @@ -0,0 +1,23 @@ +use Modern::Perl; + +return { + bug_number => "12446", + description => "Ability to allow guarantor relationship for all patron category types", + up => sub { + my ($args) = @_; + my ($dbh) = @$args{qw(dbh)}; + + unless ( column_exists( 'categories', 'canbeguarantee' ) ) { + $dbh->do(q{ + ALTER TABLE categories + ADD COLUMN `canbeguarantee` tinyint(1) NOT NULL default '0' AFTER `checkprevcheckout` + }); + } + + $dbh->do(q{ + UPDATE categories + SET canbeguarantee = 1 + WHERE category_type = 'P' OR category_type = 'C' + }); + }, +}; -- 2.20.1