From ec66ac97f065c63bc61b718e2dca204e03cae5f7 Mon Sep 17 00:00:00 2001 From: Kyle Hall Date: Thu, 23 Feb 2023 08:31:46 -0500 Subject: [PATCH] Bug 33053: Remove default value for tables item_groups and recalls These default biblio_ids of 0 are harmless but incorrect. The default values should be removed. Test Plan: 1) Apply this patch 2) prove t/db_dependent/Koha/Biblio.t 3) prove t/db_dependent/Koha/Recalls.t Signed-off-by: David Nind Signed-off-by: Aleisha Amohia Signed-off-by: Tomas Cohen Arazi --- installer/data/mysql/atomicupdate/bug_33053.pl | 16 ++++++++++++++++ installer/data/mysql/kohastructure.sql | 4 ++-- 2 files changed, 18 insertions(+), 2 deletions(-) create mode 100755 installer/data/mysql/atomicupdate/bug_33053.pl diff --git a/installer/data/mysql/atomicupdate/bug_33053.pl b/installer/data/mysql/atomicupdate/bug_33053.pl new file mode 100755 index 0000000000..8a74194aaf --- /dev/null +++ b/installer/data/mysql/atomicupdate/bug_33053.pl @@ -0,0 +1,16 @@ +use Modern::Perl; + +return { + bug_number => "33053", + description => "Remove default from biblio_id for item_groups and recalls tables", + up => sub { + my ($args) = @_; + my ($dbh, $out) = @$args{qw(dbh out)}; + $dbh->do(q{ + ALTER TABLE item_groups CHANGE COLUMN `biblio_id` `biblio_id` int(11) NOT NULL COMMENT 'id for the bibliographic record the group belongs to'` + }); + $dbh->do(q{ + ALTER TABLE recalls CHANGE COLUMN `biblio_id` `biblio_id` int(11) NOT NULL COMMENT 'Identifier for bibliographic record that has been recalled' + }); + }, +}; diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql index ba60de4d45..702f0bcdac 100644 --- a/installer/data/mysql/kohastructure.sql +++ b/installer/data/mysql/kohastructure.sql @@ -3606,7 +3606,7 @@ DROP TABLE IF EXISTS `item_groups`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `item_groups` ( `item_group_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'id for the items group', - `biblio_id` int(11) NOT NULL DEFAULT 0 COMMENT 'id for the bibliographic record the group belongs to', + `biblio_id` int(11) NOT NULL COMMENT 'id for the bibliographic record the group belongs to', `display_order` int(4) NOT NULL DEFAULT 0 COMMENT 'The ''sort order'' for item_groups', `description` mediumtext DEFAULT NULL COMMENT 'A group description', `created_on` timestamp NULL DEFAULT NULL COMMENT 'Time and date the group was created', @@ -4887,7 +4887,7 @@ CREATE TABLE `recalls` ( `recall_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'Unique identifier for this recall', `patron_id` int(11) NOT NULL DEFAULT 0 COMMENT 'Identifier for patron who requested recall', `created_date` datetime DEFAULT NULL COMMENT 'Date the recall was requested', - `biblio_id` int(11) NOT NULL DEFAULT 0 COMMENT 'Identifier for bibliographic record that has been recalled', + `biblio_id` int(11) NOT NULL COMMENT 'Identifier for bibliographic record that has been recalled', `pickup_library_id` varchar(10) DEFAULT NULL COMMENT 'Identifier for recall pickup library', `completed_date` datetime DEFAULT NULL COMMENT 'Date the recall is completed (fulfilled, cancelled or expired)', `notes` mediumtext DEFAULT NULL COMMENT 'Notes related to the recall', -- 2.39.5