From 88133aaec5ac86c0bed7fdd93cd53bcf6f297eca Mon Sep 17 00:00:00 2001 From: Janusz Kaczmarek Date: Tue, 1 Oct 2024 10:36:30 +0000 Subject: [PATCH] Bug 37511: DB changes Signed-off-by: Roman Dolny Signed-off-by: Martin Renvoize Signed-off-by: Katrin Fischer --- .../data/mysql/atomicupdate/bug_37511.pl | 30 +++++++++++++++++++ installer/data/mysql/kohastructure.sql | 1 + 2 files changed, 31 insertions(+) create mode 100755 installer/data/mysql/atomicupdate/bug_37511.pl diff --git a/installer/data/mysql/atomicupdate/bug_37511.pl b/installer/data/mysql/atomicupdate/bug_37511.pl new file mode 100755 index 0000000000..23960e1cdf --- /dev/null +++ b/installer/data/mysql/atomicupdate/bug_37511.pl @@ -0,0 +1,30 @@ +use Modern::Perl; +use Koha::Installer::Output qw(say_warning say_failure say_success say_info); +use Try::Tiny; + +return { + bug_number => "37511", + description => "Add a new column p_cs_precedes to the table currency", + up => sub { + my ($args) = @_; + my ( $dbh, $out ) = @$args{qw(dbh out)}; + + if ( !column_exists( 'currency', 'p_cs_precedes' ) ) { + try { + $dbh->do( + q{ + ALTER TABLE `currency` ADD COLUMN `p_cs_precedes` tinyint(1) DEFAULT 1 + } + ); + say_success( $out, "Added column p_cs_precedes" ); + } catch { + say_failure( + $out, + "Adding column 'currency.p_cs_precedes' failed with errors: $_" + ); + }; + } else { + say_info( $out, "Column 'currency.p_cs_precedes' already exists!" ); + } + }, +}; diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql index 1d394f32fa..7d9abcd082 100644 --- a/installer/data/mysql/kohastructure.sql +++ b/installer/data/mysql/kohastructure.sql @@ -2538,6 +2538,7 @@ CREATE TABLE `currency` ( `active` tinyint(1) DEFAULT NULL, `archived` tinyint(1) DEFAULT 0, `p_sep_by_space` tinyint(1) DEFAULT 0, + `p_cs_precedes` tinyint(1) DEFAULT 1, PRIMARY KEY (`currency`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- 2.39.5