From 7cfeb543747cea87223cfaa7e380f48df754a017 Mon Sep 17 00:00:00 2001 From: Nick Clemens Date: Thu, 28 Mar 2019 15:41:22 +0000 Subject: [PATCH] Bug 18235: DBRev 18.12.00.032 Signed-off-by: Nick Clemens --- Koha.pm | 2 +- Koha/Schema/Result/SearchField.pm | 13 ++++++++++-- ...ug_18235-add-search_field-facet_order.perl | 20 ------------------- installer/data/mysql/updatedatabase.pl | 18 +++++++++++++++++ 4 files changed, 30 insertions(+), 23 deletions(-) delete mode 100644 installer/data/mysql/atomicupdate/bug_18235-add-search_field-facet_order.perl diff --git a/Koha.pm b/Koha.pm index b37e7d31ea..d2e4379d0c 100644 --- a/Koha.pm +++ b/Koha.pm @@ -29,7 +29,7 @@ use vars qw{ $VERSION }; # - #4 : the developer version. The 4th number is the database subversion. # used by developers when the database changes. updatedatabase take care of the changes itself # and is automatically called by Auth.pm when needed. -$VERSION = "18.12.00.031"; +$VERSION = "18.12.00.032"; sub version { return $VERSION; diff --git a/Koha/Schema/Result/SearchField.pm b/Koha/Schema/Result/SearchField.pm index 0f7d943164..a347da08bb 100644 --- a/Koha/Schema/Result/SearchField.pm +++ b/Koha/Schema/Result/SearchField.pm @@ -59,6 +59,13 @@ what type of data this holds, relevant when storing it in the search engine is_nullable: 1 size: [5,2] +=head2 facet_order + + data_type: 'tinyint' + is_nullable: 1 + +the order place of the field in facet list if faceted + =cut __PACKAGE__->add_columns( @@ -78,6 +85,8 @@ __PACKAGE__->add_columns( }, "weight", { data_type => "decimal", is_nullable => 1, size => [5, 2] }, + "facet_order", + { data_type => "tinyint", is_nullable => 1 }, ); =head1 PRIMARY KEY @@ -124,8 +133,8 @@ __PACKAGE__->has_many( ); -# Created by DBIx::Class::Schema::Loader v0.07046 @ 2018-11-07 22:22:22 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:4Q+IXwF0hViF8+kpR96eLA +# Created by DBIx::Class::Schema::Loader v0.07046 @ 2019-03-28 15:31:40 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:4Hc7O2fMCses1Bgfmk6Anw __PACKAGE__->many_to_many("search_marc_maps", "search_marc_to_fields", "search_marc_map"); diff --git a/installer/data/mysql/atomicupdate/bug_18235-add-search_field-facet_order.perl b/installer/data/mysql/atomicupdate/bug_18235-add-search_field-facet_order.perl deleted file mode 100644 index c8e66b9202..0000000000 --- a/installer/data/mysql/atomicupdate/bug_18235-add-search_field-facet_order.perl +++ /dev/null @@ -1,20 +0,0 @@ -$DBversion = 'XXX'; # will be replaced by the RM -if( CheckVersion( $DBversion ) ) { - if( !column_exists( 'search_field', 'facet_order' ) ) { - $dbh->do("ALTER TABLE search_field ADD COLUMN facet_order TINYINT(4) DEFAULT NULL AFTER weight"); - } - - $dbh->do("UPDATE search_field SET facet_order=1 WHERE name='author'"); - $dbh->do("UPDATE search_field SET facet_order=2 WHERE name='itype'"); - $dbh->do("UPDATE search_field SET facet_order=3 WHERE name='location'"); - $dbh->do("UPDATE search_field SET facet_order=4 WHERE name='su-geo'"); - $dbh->do("UPDATE search_field SET facet_order=5 WHERE name='title-series'"); - $dbh->do("UPDATE search_field SET facet_order=6 WHERE name='subject'"); - $dbh->do("UPDATE search_field SET facet_order=7 WHERE name='ccode'"); - $dbh->do("UPDATE search_field SET facet_order=8 WHERE name='holdingbranch'"); - $dbh->do("UPDATE search_field SET facet_order=9 WHERE name='homebranch'"); - - # Always end with this (adjust the bug info) - SetVersion( $DBversion ); - print "Upgrade to $DBversion done (Bug 18235 - Elastic search - make facets configurable)\n"; -} diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl index ab2711ce46..8a55175ab6 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -17791,6 +17791,24 @@ if( CheckVersion( $DBversion ) ) { print "Upgrade to $DBversion done (Bug 22008 - Add missing constraints for accountlines.manager_id)\n"; } +$DBversion = '18.12.00.032'; +if( CheckVersion( $DBversion ) ) { + if( !column_exists( 'search_field', 'facet_order' ) ) { + $dbh->do("ALTER TABLE search_field ADD COLUMN facet_order TINYINT(4) DEFAULT NULL AFTER weight"); + } + $dbh->do("UPDATE search_field SET facet_order=1 WHERE name='author'"); + $dbh->do("UPDATE search_field SET facet_order=2 WHERE name='itype'"); + $dbh->do("UPDATE search_field SET facet_order=3 WHERE name='location'"); + $dbh->do("UPDATE search_field SET facet_order=4 WHERE name='su-geo'"); + $dbh->do("UPDATE search_field SET facet_order=5 WHERE name='title-series'"); + $dbh->do("UPDATE search_field SET facet_order=6 WHERE name='subject'"); + $dbh->do("UPDATE search_field SET facet_order=7 WHERE name='ccode'"); + $dbh->do("UPDATE search_field SET facet_order=8 WHERE name='holdingbranch'"); + $dbh->do("UPDATE search_field SET facet_order=9 WHERE name='homebranch'"); + SetVersion( $DBversion ); + print "Upgrade to $DBversion done (Bug 18235 - Elastic search - make facets configurable)\n"; +} + # SEE bug 13068 # if there is anything in the atomicupdate, read and execute it. -- 2.39.5