Bug 17292 - Use of DBIx in updatedatabase.pl broke upgrade (from bug 12375)
Summary: Use of DBIx in updatedatabase.pl broke upgrade (from bug 12375)
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Installation and upgrade (command-line installer) (show other bugs)
Version: Main
Hardware: All All
: P5 - low major (vote)
Assignee: Kyle M Hall
QA Contact: Testopia
URL:
Keywords:
: 17313 (view as bug list)
Depends on: 8956 12375
Blocks:
  Show dependency treegraph
 
Reported: 2016-09-12 15:08 UTC by Tomás Cohen Arazi
Modified: 2019-10-14 19:58 UTC (History)
9 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
Bug 17292 - Use of DBIx in updatedatabase.pl broke upgrade (3.77 KB, patch)
2016-09-12 15:19 UTC, Kyle M Hall
Details | Diff | Splinter Review
Bug 17292: Follow up - tweak to make it pass cleaner (1.26 KB, patch)
2016-09-19 00:59 UTC, Mark Tompsett
Details | Diff | Splinter Review
Bug 17292 - Use of DBIx in updatedatabase.pl broke upgrade (3.82 KB, patch)
2016-09-19 00:59 UTC, Mark Tompsett
Details | Diff | Splinter Review
Bug 17292: Follow up - tweak to make it pass cleaner (1.31 KB, patch)
2016-09-19 00:59 UTC, Mark Tompsett
Details | Diff | Splinter Review
Bug 17292 - Use of DBIx in updatedatabase.pl broke upgrade (3.89 KB, patch)
2016-09-28 08:08 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 17292: Follow up - tweak to make it pass cleaner (1.38 KB, patch)
2016-09-28 08:08 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 17292 Follow-up, fix typos (1.64 KB, patch)
2016-10-22 10:35 UTC, Frédéric Demians
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Tomás Cohen Arazi 2016-09-12 15:08:32 UTC

    
Comment 1 Tomás Cohen Arazi 2016-09-12 15:13:11 UTC
A recent change in the 'subscription' table structure highlighted a problem in a DBRev upgrade (3.23.00.006). As it adds a new column, when upgrading from (say) 3.20.00.000 the code/schema (correctly) expects the subscription.itemtype column to exist. But it is not created until DBRev 16.06.00.025.

To reproduce:
- Have a clean 3.20.00 DB loaded into kohadevbox
- Checkout current master
- Run:
  $ perl installer/data/mysql/updatedatabase.pl
=> FAIL: The upgrade procedure fails due to missing colum.

The solution: rewrite the updatedatabase.pl entry using plain DBI.
Comment 2 Kyle M Hall 2016-09-12 15:19:44 UTC
Created attachment 55502 [details] [review]
Bug 17292 - Use of DBIx in updatedatabase.pl broke upgrade

A recent change in the 'subscription' table structure highlighted a
problem in a DBRev upgrade (3.23.00.006). As it adds a new column, when
upgrading from (say) 3.20.00.000 the code/schema (correctly) expects the
subscription.itemtype column to exist. But it is not created until DBRev
16.06.00.025.

To reproduce:
- Have a clean 3.20.00 DB loaded into kohadevbox
- Checkout current master
- Run:
  $ perl installer/data/mysql/updatedatabase.pl
  => FAIL: The upgrade procedure fails due to missing colum.

  The solution: rewrite the updatedatabase.pl entry using plain DBI
Comment 3 Mark Tompsett 2016-09-19 00:59:02 UTC
Created attachment 55672 [details] [review]
Bug 17292: Follow up - tweak to make it pass cleaner

remove a 'my'
next if not defined subscriptions.
Comment 4 Mark Tompsett 2016-09-19 00:59:26 UTC
Created attachment 55673 [details] [review]
Bug 17292 - Use of DBIx in updatedatabase.pl broke upgrade

A recent change in the 'subscription' table structure highlighted a
problem in a DBRev upgrade (3.23.00.006). As it adds a new column, when
upgrading from (say) 3.20.00.000 the code/schema (correctly) expects the
subscription.itemtype column to exist. But it is not created until DBRev
16.06.00.025.

To reproduce:
- Have a clean 3.20.00 DB loaded into kohadevbox
- Checkout current master
- Run:
  $ perl installer/data/mysql/updatedatabase.pl
  => FAIL: The upgrade procedure fails due to missing colum.

  The solution: rewrite the updatedatabase.pl entry using plain DBI

Signed-off-by: Mark Tompsett <mtompset@hotmail.com>
Comment 5 Mark Tompsett 2016-09-19 00:59:31 UTC
Created attachment 55674 [details] [review]
Bug 17292: Follow up - tweak to make it pass cleaner

remove a 'my'
next if not defined subscriptions.

Signed-off-by: Mark Tompsett <mtompset@hotmail.com>
Comment 6 Mark Tompsett 2016-09-19 01:01:12 UTC
Setting to signed off, unless QA folks think my follow up really needs lots of testing.
Comment 7 Mark Tompsett 2016-09-19 03:31:17 UTC
*** Bug 17313 has been marked as a duplicate of this bug. ***
Comment 8 Jonathan Druart 2016-09-28 08:08:38 UTC
Created attachment 55861 [details] [review]
Bug 17292 - Use of DBIx in updatedatabase.pl broke upgrade

A recent change in the 'subscription' table structure highlighted a
problem in a DBRev upgrade (3.23.00.006). As it adds a new column, when
upgrading from (say) 3.20.00.000 the code/schema (correctly) expects the
subscription.itemtype column to exist. But it is not created until DBRev
16.06.00.025.

To reproduce:
- Have a clean 3.20.00 DB loaded into kohadevbox
- Checkout current master
- Run:
  $ perl installer/data/mysql/updatedatabase.pl
  => FAIL: The upgrade procedure fails due to missing colum.

  The solution: rewrite the updatedatabase.pl entry using plain DBI

Signed-off-by: Mark Tompsett <mtompset@hotmail.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Comment 9 Jonathan Druart 2016-09-28 08:08:41 UTC
Created attachment 55862 [details] [review]
Bug 17292: Follow up - tweak to make it pass cleaner

remove a 'my'
next if not defined subscriptions.

Signed-off-by: Mark Tompsett <mtompset@hotmail.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Comment 10 Brendan Gallagher 2016-10-10 10:34:11 UTC
Pushed to Master - Should be in the November Release 16.11 - Thanks!
Comment 11 Frédéric Demians 2016-10-22 08:21:23 UTC
Pushed in 16.05. Will be in 16.05.05.
Comment 12 Frédéric Demians 2016-10-22 10:35:19 UTC
Created attachment 56734 [details] [review]
Bug 17292 Follow-up, fix typos

- wrong assignation
- reference to 'serials' table rather than 'serial'

Signed-off-by: Frédéric Demians <f.demians@tamil.fr>
Comment 13 Frédéric Demians 2016-10-22 10:36:14 UTC
Note to RM: This follow-up is required for 16.05, but also for master.
Comment 14 Jonathan Druart 2016-11-28 11:51:53 UTC
(In reply to Frédéric Demians from comment #13)
> Note to RM: This follow-up is required for 16.05, but also for master.

Ping RM!
Comment 15 Jonathan Druart 2016-11-28 11:57:20 UTC
(In reply to Frédéric Demians from comment #12)
> Created attachment 56734 [details] [review] [review]
> Bug 17292 Follow-up, fix typos
> 
> - wrong assignation
> - reference to 'serials' table rather than 'serial'
> 
> Signed-off-by: Frédéric Demians <f.demians@tamil.fr>

We need that one for the 16.11 package as well.
Comment 16 Ian Palko 2017-05-02 12:52:31 UTC
(In reply to Jonathan Druart from comment #15)
> (In reply to Frédéric Demians from comment #12)
> > Created attachment 56734 [details] [review] [review] [review]
> > Bug 17292 Follow-up, fix typos
> > 
> > - wrong assignation
> > - reference to 'serials' table rather than 'serial'
> > 
> > Signed-off-by: Frédéric Demians <f.demians@tamil.fr>
> 
> We need that one for the 16.11 package as well.

I'll confirm that the 16.11 packages still fail as of today when moving an old database (3.22) to 16.11.

Upgrade to oldstable (16.05) then to stable (16.11) succeeded without issue.
Comment 17 Katrin Fischer 2017-11-15 20:24:52 UTC
We just updated a greater number of installations from 3.22.18 to 16.11.13 without any issues. This appears to be fixed.
Comment 18 Marcel de Rooy 2017-12-11 07:37:04 UTC
See also bug 19789.
We need a coding guideline for these things in general. And make developers aware of it.
Comment 19 Katrin Fischer 2017-12-11 09:55:32 UTC
(In reply to Marcel de Rooy from comment #18)
> See also bug 19789.
> We need a coding guideline for these things in general. And make developers
> aware of it.

Hi Marcel and Jonathan, I have added it as a topic to the next developer meeting:
https://wiki.koha-community.org/wiki/Development_IRC_meeting_13_December_2017#Agenda