Bug 21931 - Upgrade from 3.22 fails when running updatedatabase.pl script
Summary: Upgrade from 3.22 fails when running updatedatabase.pl script
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Database (show other bugs)
Version: master
Hardware: All All
: P5 - low major (vote)
Assignee: Jonathan Druart
QA Contact: Martin Renvoize
URL:
Keywords:
Depends on:
Blocks: 19789
  Show dependency treegraph
 
Reported: 2018-12-01 17:20 UTC by Alex Bernier
Modified: 2020-01-06 20:14 UTC (History)
6 users (show)

See Also:
Change sponsored?: ---
Patch complexity: Small patch
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:


Attachments
Fix updatedatabase.pl (2.26 KB, text/plain)
2018-12-01 17:39 UTC, Alex Bernier
Details
Bug 21931: Do not reset the ES mapping on 3.23.00.050 (2.00 KB, patch)
2018-12-07 19:54 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 21931: Do not reset the ES mapping on 3.23.00.050 (2.07 KB, patch)
2018-12-13 13:59 UTC, Kyle M Hall
Details | Diff | Splinter Review
Bug 21931: Do not reset the ES mapping on 3.23.00.050 (2.12 KB, patch)
2018-12-13 14:29 UTC, Martin Renvoize
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Alex Bernier 2018-12-01 17:20:41 UTC
When upgrading from Koha 3.22 to 18.11, the DB update process (updatedatabase.pl) fails 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
Comment 1 Alex Bernier 2018-12-01 17:39:31 UTC
Created attachment 82822 [details]
Fix updatedatabase.pl
Comment 2 Jonathan Druart 2018-12-07 19:54:04 UTC
Created attachment 83001 [details] [review]
Bug 21931: Do not reset the ES mapping on 3.23.00.050

This update DB entry uses DBIx schema which does not make it crashes if
the table structure is changed.
Which happens on 18.06.00.054, that added search_field.weight

The entry 3.23.00.050 fails with
  Unknown column 'me.weight' in 'field list'

This patch removes the reset of the mapping and display a warning to
tell the administrator the mapping must be reset/inserted

Test plan:
Use a 3.22 dump and upgrade it
Comment 3 Jonathan Druart 2018-12-07 19:55:30 UTC
Hi Alex,
Thanks for reporting it.
I have proposed another approach: remove the reset of the ES mappings.
It will make it more robust as it will not explode in the future if the table structure changed again.

Do not forget to change the status when you submit a patch that is ready to be tested.
Comment 4 Kyle M Hall 2018-12-13 13:59:17 UTC
Created attachment 83166 [details] [review]
Bug 21931: Do not reset the ES mapping on 3.23.00.050

This update DB entry uses DBIx schema which does not make it crashes if
the table structure is changed.
Which happens on 18.06.00.054, that added search_field.weight

The entry 3.23.00.050 fails with
  Unknown column 'me.weight' in 'field list'

This patch removes the reset of the mapping and display a warning to
tell the administrator the mapping must be reset/inserted

Test plan:
Use a 3.22 dump and upgrade it

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Comment 5 Martin Renvoize 2018-12-13 14:29:34 UTC
Created attachment 83171 [details] [review]
Bug 21931: Do not reset the ES mapping on 3.23.00.050

This update DB entry uses DBIx schema which does not make it crashes if
the table structure is changed.
Which happens on 18.06.00.054, that added search_field.weight

The entry 3.23.00.050 fails with
  Unknown column 'me.weight' in 'field list'

This patch removes the reset of the mapping and display a warning to
tell the administrator the mapping must be reset/inserted

Test plan:
Use a 3.22 dump and upgrade it

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 6 Martin Renvoize 2018-12-13 14:30:04 UTC
Passing QA here.. a sound fix.
Comment 7 Nick Clemens 2018-12-14 15:33:42 UTC
Awesome work all!

Pushed to master for 19.05
Comment 8 Martin Renvoize 2018-12-17 12:05:32 UTC
Pushed to 18.11.x for 18.11.01
Comment 9 Lucas Gass 2018-12-26 17:25:14 UTC
backported to 18.05 for 18.05.08
Comment 10 Fridolin Somers 2019-01-02 10:03:31 UTC
Pushed to 17.11.x for 17.11.14