From 0f3febe8e261ec5979974a7e732fb14a8ac96aed Mon Sep 17 00:00:00 2001 From: Katrin Fischer Date: Fri, 22 Sep 2023 15:35:01 +0000 Subject: [PATCH] Bug 34686: Add reserve_id to tmp_holdsqueue table (database update) --- .../atomicupdate/bug_34686_reserve_id.pl | 22 +++++++++++++++++++ installer/data/mysql/kohastructure.sql | 5 ++++- 2 files changed, 26 insertions(+), 1 deletion(-) create mode 100755 installer/data/mysql/atomicupdate/bug_34686_reserve_id.pl diff --git a/installer/data/mysql/atomicupdate/bug_34686_reserve_id.pl b/installer/data/mysql/atomicupdate/bug_34686_reserve_id.pl new file mode 100755 index 0000000000..b9a41e5167 --- /dev/null +++ b/installer/data/mysql/atomicupdate/bug_34686_reserve_id.pl @@ -0,0 +1,22 @@ +use Modern::Perl; + +return { + bug_number => "34686", + description => "Add reserve_id to tmp_holdsqueue table", + up => sub { + my ($args) = @_; + my ( $dbh, $out ) = @$args{qw(dbh out)}; + + unless ( column_exists( 'tmp_holdsqueue', 'reserve_id' ) ) { + $dbh->do( + q{ + ALTER TABLE tmp_holdsqueue ADD reserve_id int(11) NULL DEFAULT NULL FIRST + } + ); + $dbh->do( + q{ ALTER TABLE tmp_holdsqueue ADD CONSTRAINT `tmp_holdsqueue_ibfk_4` FOREIGN KEY (`reserve_id`) REFERENCES `reserves` (`reserve_id`) ON DELETE CASCADE ON UPDATE CASCADE } + ); + say $out "Added column 'tmp_holdsqueue.reserve_id'"; + } + }, +}; diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql index add4518807..8a3b442da9 100644 --- a/installer/data/mysql/kohastructure.sql +++ b/installer/data/mysql/kohastructure.sql @@ -5869,6 +5869,7 @@ DROP TABLE IF EXISTS `tmp_holdsqueue`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `tmp_holdsqueue` ( + `reserve_id` int(11) DEFAULT NULL, `biblionumber` int(11) DEFAULT NULL, `itemnumber` int(11) NOT NULL, `barcode` varchar(20) DEFAULT NULL, @@ -5889,9 +5890,11 @@ CREATE TABLE `tmp_holdsqueue` ( KEY `tmp_holdsqueue_ibfk_1` (`itemnumber`), KEY `tmp_holdsqueue_ibfk_2` (`biblionumber`), KEY `tmp_holdsqueue_ibfk_3` (`borrowernumber`), + KEY `tmp_holdsqueue_ibfk_4` (`reserve_id`), CONSTRAINT `tmp_holdsqueue_ibfk_1` FOREIGN KEY (`itemnumber`) REFERENCES `items` (`itemnumber`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `tmp_holdsqueue_ibfk_2` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE, - CONSTRAINT `tmp_holdsqueue_ibfk_3` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE + CONSTRAINT `tmp_holdsqueue_ibfk_3` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `tmp_holdsqueue_ibfk_4` FOREIGN KEY (`reserve_id`) REFERENCES `reserves` (`reserve_id`) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- 2.30.2