Bug 27153: DB Updates

We start by adding the field to the table

It is possible a library would want two versions of the same field in
the indexing. We need to make the filter part of the primary key in
order to allow this

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
This commit is contained in:
Nick Clemens 2023-09-01 12:38:44 +00:00 committed by Tomas Cohen Arazi
parent 3c319d988c
commit 333109c7fd
Signed by: tomascohen
GPG key ID: 0A272EA1B2F3C15F
2 changed files with 32 additions and 0 deletions

View file

@ -0,0 +1,31 @@
use Modern::Perl;
return {
bug_number => "27153",
description => "Add option to filter search fields",
up => sub {
my ($args) = @_;
my ( $dbh, $out ) = @$args{qw(dbh out)};
unless ( column_exists( 'search_marc_to_field', 'filter' ) ) {
$dbh->do(
q{
ALTER TABLE search_marc_to_field
ADD filter varchar(100) NOT NULL DEFAULT '' COMMENT 'specify a filter to be applied to field'
AFTER search
}
);
say $out "Added column 'search_marc_to_field.filter'";
}
unless ( primary_key_exists( 'search_marc_to_field', 'filter' ) ) {
$dbh->do(
q{
ALTER TABLE search_marc_to_field
DROP PRIMARY KEY,
ADD PRIMARY KEY (search_marc_map_id,search_field_id,filter)
}
);
say $out "Updated primary key to include filter";
}
},
};

View file

@ -5392,6 +5392,7 @@ DROP TABLE IF EXISTS `search_marc_to_field`;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `search_marc_to_field` (
`search` tinyint(1) NOT NULL DEFAULT 1,
`filter` varchar(100) NOT NULL DEFAULT '' COMMENT 'specify a filter to be applied to field',
`search_marc_map_id` int(11) NOT NULL,
`search_field_id` int(11) NOT NULL,
`facet` tinyint(1) DEFAULT 0 COMMENT 'true if a facet field should be generated for this',