From b12f3515d88886d0a8bb59c5f72a76a2f4b51afd Mon Sep 17 00:00:00 2001 From: Tomas Cohen Arazi Date: Wed, 11 Oct 2023 11:32:25 -0300 Subject: [PATCH] Bug 16223: (QA follow-up) Adjust DB changes Signed-off-by: Tomas Cohen Arazi --- .../data/mysql/atomicupdate/bug_16223.pl | 36 ++++++++++++------- installer/data/mysql/kohastructure.sql | 2 ++ 2 files changed, 25 insertions(+), 13 deletions(-) diff --git a/installer/data/mysql/atomicupdate/bug_16223.pl b/installer/data/mysql/atomicupdate/bug_16223.pl index 12aa40823a..65269c8b39 100755 --- a/installer/data/mysql/atomicupdate/bug_16223.pl +++ b/installer/data/mysql/atomicupdate/bug_16223.pl @@ -1,24 +1,34 @@ use Modern::Perl; return { - bug_number => "16223", + bug_number => "16223", description => "Add new columns lift_after_payment and fee_limit to table restriction_types", - up => sub { + up => sub { my ($args) = @_; - my ($dbh, $out) = @$args{qw(dbh out)}; + my ( $dbh, $out ) = @$args{qw(dbh out)}; - if( !column_exists( 'restriction_types', 'lift_after_payment' ) ) { - $dbh->do(q{ - ALTER TABLE restriction_types ADD COLUMN `lift_after_payment` tinyint(1) NOT NULL DEFAULT 0 - }); + if ( !column_exists( 'restriction_types', 'lift_after_payment' ) ) { + $dbh->do( + q{ + ALTER TABLE restriction_types + ADD COLUMN `lift_after_payment` tinyint(1) NOT NULL DEFAULT 0 + AFTER `is_default` + } + ); + + say $out "Added column 'restriction_types.lift_after_payment'"; } - say $out "Added column lift_after_payment"; - if( !column_exists( 'restriction_types', 'fee_limit' ) ) { - $dbh->do(q{ - ALTER TABLE restriction_types ADD COLUMN `fee_limit` decimal(28,6) DEFAULT NULL - }); + if ( !column_exists( 'restriction_types', 'fee_limit' ) ) { + $dbh->do( + q{ + ALTER TABLE restriction_types + ADD COLUMN `fee_limit` decimal(28,6) DEFAULT NULL + AFTER `lift_after_payment` + } + ); + + say $out "Added column 'restriction_types.fee_limit'"; } - say $out "Added column fee_limit"; }, }; diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql index daaf3926ef..d91bd46b32 100644 --- a/installer/data/mysql/kohastructure.sql +++ b/installer/data/mysql/kohastructure.sql @@ -5048,6 +5048,8 @@ CREATE TABLE `restriction_types` ( `display_text` text NOT NULL, `is_system` tinyint(1) NOT NULL DEFAULT 0, `is_default` tinyint(1) NOT NULL DEFAULT 0, + `lift_after_payment` tinyint(1) NOT NULL DEFAULT 0, + `fee_limit` decimal(28,6) DEFAULT NULL, PRIMARY KEY (`code`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- 2.39.5