From 6f36c1eb8acbe013b61bed0aad829ead45cb8298 Mon Sep 17 00:00:00 2001 From: Nick Clemens Date: Tue, 6 Aug 2024 17:37:12 +0000 Subject: [PATCH] Bug 33641: DB update Signed-off-by: Andrew Fuerste-Henry --- .../data/mysql/atomicupdate/bug_33641.pl | 35 +++++++++++++++++++ installer/data/mysql/kohastructure.sql | 2 ++ 2 files changed, 37 insertions(+) create mode 100755 installer/data/mysql/atomicupdate/bug_33641.pl diff --git a/installer/data/mysql/atomicupdate/bug_33641.pl b/installer/data/mysql/atomicupdate/bug_33641.pl new file mode 100755 index 0000000000..e738d50a0a --- /dev/null +++ b/installer/data/mysql/atomicupdate/bug_33641.pl @@ -0,0 +1,35 @@ +use Modern::Perl; +use Koha::Installer::Output qw(say_warning say_failure say_success say_info); + +return { + bug_number => "33641", + description => "Added issues.return_branch and old_issues.return_branch", + up => sub { + my ($args) = @_; + my ( $dbh, $out ) = @$args{qw(dbh out)}; + + if ( !column_exists( 'issues', 'return_branch' ) ) { + $dbh->do( + q{ + ALTER TABLE issues + ADD COLUMN return_branch varchar(10) DEFAULT NULL + COMMENT 'foreign key, linking to the branches table for the location the item was returned' + AFTER returndate + } + ); + say_success( $out, "Added column 'issues.return_branch'" ); + } + if ( !column_exists( 'old_issues', 'return_branch' ) ) { + $dbh->do( + q{ + ALTER TABLE old_issues + ADD COLUMN return_branch varchar(10) DEFAULT NULL + COMMENT 'foreign key, linking to the branches table for the location the item was returned' + AFTER returndate + } + ); + say_success( $out, "Added column 'old_issues.return_branch'" ); + } + + }, +}; diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql index 07b1e78e1f..1c966c45f3 100644 --- a/installer/data/mysql/kohastructure.sql +++ b/installer/data/mysql/kohastructure.sql @@ -3879,6 +3879,7 @@ CREATE TABLE `issues` ( `date_due` datetime DEFAULT NULL COMMENT 'datetime the item is due (yyyy-mm-dd hh:mm::ss)', `branchcode` varchar(10) DEFAULT NULL COMMENT 'foreign key, linking to the branches table for the location the item was checked out', `returndate` datetime DEFAULT NULL COMMENT 'date the item was returned, will be NULL until moved to old_issues', + `return_branch` varchar(10) DEFAULT NULL COMMENT 'foreign key, linking to the branches table for the location the item was returned', `lastreneweddate` datetime DEFAULT NULL COMMENT 'date the item was last renewed', `renewals_count` tinyint(4) NOT NULL DEFAULT 0 COMMENT 'lists the number of times the item was renewed', `unseen_renewals` tinyint(4) NOT NULL DEFAULT 0 COMMENT 'lists the number of consecutive times the item was renewed without being seen', @@ -4881,6 +4882,7 @@ CREATE TABLE `old_issues` ( `date_due` datetime DEFAULT NULL COMMENT 'date the item is due (yyyy-mm-dd)', `branchcode` varchar(10) DEFAULT NULL COMMENT 'foreign key, linking to the branches table for the location the item was checked out', `returndate` datetime DEFAULT NULL COMMENT 'date the item was returned', + `return_branch` varchar(10) DEFAULT NULL COMMENT 'foreign key, linking to the branches table for the location the item was returned', `lastreneweddate` datetime DEFAULT NULL COMMENT 'date the item was last renewed', `renewals_count` tinyint(4) NOT NULL DEFAULT 0 COMMENT 'lists the number of times the item was renewed', `unseen_renewals` tinyint(4) NOT NULL DEFAULT 0 COMMENT 'lists the number of consecutive times the item was renewed without being seen', -- 2.39.2