From 5a05b9faa8e2b41816a2f1201fcb8482a51294f1 Mon Sep 17 00:00:00 2001 From: Alex Bernier Date: Sat, 1 Dec 2018 18:22:00 +0100 Subject: [PATCH] Bug 21931: Fix a bug when upgrading from from 3.22 to 18.11 Content-Type: text/plain; charset="utf-8" When ugprading from Koha 3.22 to 18.11, the updatedatabase.pl script fails when running the DBversion = "3.23.00.050" step, because the "weight" column is not present in the "search_field" table. The call to "Koha::SearchEngine::Elasticsearch->reset_elasticsearch_mappings" fails. This patch adds the "weight" column to fix the issue. To test : - Import a Koha 3.22 database - Try to update the DB using the 18.11 codebase with installer/data/mysql/updatedatabase.pl - The DB update process fails and stops with the following error message : DBD::mysql::st execute failed: Unknown column 'me.weight' in 'field list' [for Statement "SELECT `me`.`id`, `me`.`name`, `me`.`label`, `me`.`type`, `me`.`weight` FROM `search_field` `me` WHERE ( `me`.`name` = ? )" with ParamValues: 0='suppress'] at /usr/share/perl5/DBIx/Class/Storage/DBI.pm line 1836. DBIx::Class::Storage::DBI::_dbh_execute(): Unknown column 'me.weight' in 'field list' at /.../Koha/Objects.pm line 110 - Apply the patch - Run installer/data/mysql/updatedatabase.pl again - The update process should go ahead --- installer/data/mysql/updatedatabase.pl | 1 + 1 file changed, 1 insertion(+) diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl index d0eb565bfd..090327a135 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -12339,6 +12339,7 @@ if ( CheckVersion($DBversion) ) { `name` varchar(255) NOT NULL COMMENT 'the name of the field as it will be stored in the search engine', `label` varchar(255) NOT NULL COMMENT 'the human readable name of the field, for display', `type` ENUM('', 'string', 'date', 'number', 'boolean', 'sum') NOT NULL COMMENT 'what type of data this holds, relevant when storing it in the search engine', + `weight` decimal(5,2) DEFAULT NULL, PRIMARY KEY (`id`), UNIQUE KEY (`name`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci -- 2.17.1