From 7ae4128e746d08bae85105080ba18dc6d2c40e03 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Fri, 22 Nov 2019 12:33:41 +0100 Subject: [PATCH] Bug 24010: DB Changes Amended-patch: adjusted to new atomic update format Signed-off-by: David Nind Signed-off-by: Jonathan Druart Signed-off-by: Tomas Cohen Arazi (cherry picked from commit a7eee1027993efa7d34181a77e70ac5d9f129379) Signed-off-by: Lucas Gass (cherry picked from commit 07d00657e0061e20cda82bc89e93a8a58e92e5c6) Signed-off-by: Arthur Suzuki --- .../data/mysql/atomicupdate/bug_24010.pl | 30 +++++++++++++++++++ installer/data/mysql/kohastructure.sql | 4 +-- 2 files changed, 32 insertions(+), 2 deletions(-) create mode 100755 installer/data/mysql/atomicupdate/bug_24010.pl diff --git a/installer/data/mysql/atomicupdate/bug_24010.pl b/installer/data/mysql/atomicupdate/bug_24010.pl new file mode 100755 index 0000000000..d0bbe10eb1 --- /dev/null +++ b/installer/data/mysql/atomicupdate/bug_24010.pl @@ -0,0 +1,30 @@ +use Modern::Perl; + +return { + bug_number => "24010", + description => "Make subscription.staffdisplaycount and opacdisplaycount integer columns", + up => sub { + my ($args) = @_; + my ($dbh, $out) = @$args{qw(dbh out)}; + + $dbh->do(q{ + UPDATE subscription + SET staffdisplaycount = NULL + WHERE staffdisplaycount = "" + }); + $dbh->do(q{ + ALTER TABLE subscription + MODIFY COLUMN staffdisplaycount INT(11) NULL DEFAULT NULL + }); + + $dbh->do(q{ + UPDATE subscription + SET opacdisplaycount = NULL + WHERE opacdisplaycount = "" + }); + $dbh->do(q{ + ALTER TABLE subscription + MODIFY COLUMN opacdisplaycount INT(11) NULL DEFAULT NULL + }); + }, +}; diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql index fa59fdb47b..1bad17296a 100644 --- a/installer/data/mysql/kohastructure.sql +++ b/installer/data/mysql/kohastructure.sql @@ -4824,8 +4824,8 @@ CREATE TABLE `subscription` ( `branchcode` varchar(10) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT 'default branches (items.homebranch)', `lastbranch` varchar(10) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `serialsadditems` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'does receiving this serial create an item record', - `staffdisplaycount` varchar(10) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'how many issues to show to the staff', - `opacdisplaycount` varchar(10) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'how many issues to show to the public', + `staffdisplaycount` INT(11) NULL DEFAULT NULL, -- how many issues to show to the staff + `opacdisplaycount` INT(11) NULL DEFAULT NULL, -- how many issues to show to the public `graceperiod` int(11) NOT NULL DEFAULT 0 COMMENT 'grace period in days', `enddate` date DEFAULT NULL COMMENT 'subscription end date', `closed` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'yes / no if the subscription is closed', -- 2.39.5