Bug 18235: DBRev 18.12.00.032

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
This commit is contained in:
Nick Clemens 2019-03-28 15:41:22 +00:00
parent 450fbad751
commit 7cfeb54374
4 changed files with 30 additions and 23 deletions

View File

@ -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;

View File

@ -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");

View File

@ -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";
}

View File

@ -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.