From 4a2338b331ceabbcd6ab53ff208427a2b0365874 Mon Sep 17 00:00:00 2001 From: Andreas Jonsson Date: Mon, 20 May 2024 23:23:27 +0200 Subject: [PATCH] Bug 15536: Update database schema --- Koha/Schema/Result/Matchcheck.pm | 8 ++++++++ Koha/Schema/Result/MatchpointComponent.pm | 7 +++++++ ...matchcheck-operator-and-constant-values.pl | 20 +++++++++++++++++++ installer/data/mysql/kohastructure.sql | 2 ++ 4 files changed, 37 insertions(+) create mode 100755 installer/data/mysql/atomicupdate/bug_15536-matchcheck-operator-and-constant-values.pl diff --git a/Koha/Schema/Result/Matchcheck.pm b/Koha/Schema/Result/Matchcheck.pm index 39b94f9c8c..1dcac847a5 100644 --- a/Koha/Schema/Result/Matchcheck.pm +++ b/Koha/Schema/Result/Matchcheck.pm @@ -47,6 +47,12 @@ __PACKAGE__->table("matchchecks"); is_foreign_key: 1 is_nullable: 0 +=head2 operator + + data_type: 'varchar' + is_nullable: 1 + size: 32 + =cut __PACKAGE__->add_columns( @@ -58,6 +64,8 @@ __PACKAGE__->add_columns( { data_type => "integer", is_foreign_key => 1, is_nullable => 0 }, "target_matchpoint_id", { data_type => "integer", is_foreign_key => 1, is_nullable => 0 }, + "operator", + { data_type => "varchar", is_nullable => 1, size => 32 }, ); =head1 PRIMARY KEY diff --git a/Koha/Schema/Result/MatchpointComponent.pm b/Koha/Schema/Result/MatchpointComponent.pm index e3b2a65a09..f93ab0b5bf 100644 --- a/Koha/Schema/Result/MatchpointComponent.pm +++ b/Koha/Schema/Result/MatchpointComponent.pm @@ -42,6 +42,11 @@ __PACKAGE__->table("matchpoint_components"); default_value: 0 is_nullable: 0 +=head2 constant + + data_type: 'mediumtext' + is_nullable: 1 + =head2 tag data_type: 'varchar' @@ -82,6 +87,8 @@ __PACKAGE__->add_columns( default_value => 0, is_nullable => 0, }, + "constant", + { data_type => "mediumtext", is_nullable => 1 }, "tag", { data_type => "varchar", default_value => "", is_nullable => 0, size => 3 }, "subfields", diff --git a/installer/data/mysql/atomicupdate/bug_15536-matchcheck-operator-and-constant-values.pl b/installer/data/mysql/atomicupdate/bug_15536-matchcheck-operator-and-constant-values.pl new file mode 100755 index 0000000000..43b8b753d5 --- /dev/null +++ b/installer/data/mysql/atomicupdate/bug_15536-matchcheck-operator-and-constant-values.pl @@ -0,0 +1,20 @@ +use Modern::Perl; + +return { + bug_number => "15536", + description => "Additional match check comparison.", + up => sub { + my ($args) = @_; + my ( $dbh, $out ) = @$args{qw(dbh out)}; + + say $out "Add column operator."; + $dbh->do( + q{ALTER TABLE matchchecks ADD COLUMN IF NOT EXISTS `operator` varchar(32) NOT NULL DEFAULT 'eq' AFTER `target_matchpoint_id`} + ); + + say $out "Add column constant."; + $dbh->do( + q{ALTER TABLE matchpoint_components ADD COLUMN IF NOT EXISTS `constant` mediumtext DEFAULT NULL AFTER `sequence`} + ); + }, +}; diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql index 3e7ea0b8ad..d6b1c4c401 100644 --- a/installer/data/mysql/kohastructure.sql +++ b/installer/data/mysql/kohastructure.sql @@ -4560,6 +4560,7 @@ CREATE TABLE `matchchecks` ( `matchcheck_id` int(11) NOT NULL AUTO_INCREMENT, `source_matchpoint_id` int(11) NOT NULL, `target_matchpoint_id` int(11) NOT NULL, + `operator` varchar(32) NOT NULL DEFAULT 'eq', PRIMARY KEY (`matchcheck_id`), KEY `matcher_matchchecks_ifbk_1` (`matcher_id`), KEY `matcher_matchchecks_ifbk_2` (`source_matchpoint_id`), @@ -4613,6 +4614,7 @@ DROP TABLE IF EXISTS `matchpoint_components`; CREATE TABLE `matchpoint_components` ( `matchpoint_id` int(11) NOT NULL, `matchpoint_component_id` int(11) NOT NULL AUTO_INCREMENT, + `constant` mediumtext DEFAULT NULL, `sequence` int(11) NOT NULL DEFAULT 0, `tag` varchar(3) NOT NULL DEFAULT '', `subfields` varchar(40) NOT NULL DEFAULT '', -- 2.39.2