From f6fab3ef53cb4899c170c38fe7bb54bd65d93c61 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 --- installer/data/mysql/atomicupdate/bug_24010.perl | 29 ++++++++++++++++++++++++ installer/data/mysql/kohastructure.sql | 4 ++-- 2 files changed, 31 insertions(+), 2 deletions(-) create mode 100644 installer/data/mysql/atomicupdate/bug_24010.perl diff --git a/installer/data/mysql/atomicupdate/bug_24010.perl b/installer/data/mysql/atomicupdate/bug_24010.perl new file mode 100644 index 0000000000..9db6b350df --- /dev/null +++ b/installer/data/mysql/atomicupdate/bug_24010.perl @@ -0,0 +1,29 @@ +$DBversion = 'XXX'; # will be replaced by the RM +if( CheckVersion( $DBversion ) ) { + + my $RaiseError = $dbh->{RaiseError}; + $dbh->{RaiseError} = 1; + eval { + $dbh->do(q| + ALTER TABLE subscription + MODIFY COLUMN staffdisplaycount INT(11) NULL DEFAULT NULL; + |); + }; + if ( $@ ) { + warn "You have values in subscription.staffdisplaycount that are not integer. You must modify them manual and execute manually the previous SQL query.\n"; + } + + eval { + $dbh->do(q| + ALTER TABLE subscription + MODIFY COLUMN opacdisplaycount INT(11) NULL DEFAULT NULL; + |); + }; + if ( $@ ) { + warn "You have values in subscription.opacdisplaycount that are not integer. You must modify them manual and execute manually the previous SQL query.\n"; + } + $dbh->{RaiseError} = $RaiseError; + + SetVersion( $DBversion ); + print "Upgrade to $DBversion done (Bug 24010 Make subscription.staffdisplaycount and opacdisplaycount integer columns)\n"; +} diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql index 67495ab962..dcb7f5fac1 100644 --- a/installer/data/mysql/kohastructure.sql +++ b/installer/data/mysql/kohastructure.sql @@ -2022,8 +2022,8 @@ CREATE TABLE `subscription` ( -- information related to the subscription `branchcode` varchar(10) NOT NULL default '', -- default branches (items.homebranch) `lastbranch` varchar(10), `serialsadditems` tinyint(1) NOT NULL default '0', -- does receiving this serial create an item record - `staffdisplaycount` VARCHAR(10) NULL, -- how many issues to show to the staff - `opacdisplaycount` VARCHAR(10) NULL, -- 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', -- grace period in days `enddate` date default NULL, -- subscription end date `closed` INT(1) NOT NULL DEFAULT 0, -- yes / no if the subscription is closed -- 2.11.0