Bug 9064 - statistics.ccode specified inconsistently
Summary: statistics.ccode specified inconsistently
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Architecture, internals, and plumbing (show other bugs)
Version: 3.10
Hardware: All All
: P1 - high blocker (vote)
Assignee: Paul Poulain
QA Contact: Jonathan Druart
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-11-13 00:23 UTC by Jared Camins-Esakov
Modified: 2019-06-27 09:24 UTC (History)
7 users (show)

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


Attachments
Bug 9064: fix statistics.ccode column (2.44 KB, patch)
2012-11-21 12:47 UTC, Paul Poulain
Details | Diff | Splinter Review
Bug 9064: fix statistics.ccode column (2.54 KB, patch)
2012-11-21 13:21 UTC, Kyle M Hall
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Jared Camins-Esakov 2012-11-13 00:23:44 UTC
From updatedatabase.pl:
    $dbh->do("ALTER TABLE statistics ADD COLUMN ccode VARCHAR ( 10 ) NULL AFTER associatedborrower");

From kohastructure.sql:
  `ccode` int(11) default NULL, -- foreign key from the items table, links transaction to a specific collection code

I believe the variant in updatedatabase.pl is probably what was wanted.

Also, further testing is needed to confirm that the update works at all, as it seems not to have run at all when I updated my system past 3.09.00.044.
Comment 1 Paul Poulain 2012-11-21 12:42:17 UTC
I'm on it, patch coming in a few minuts
Comment 2 Paul Poulain 2012-11-21 12:47:18 UTC Comment hidden (obsolete)
Comment 3 Paul Poulain 2012-11-21 12:48:09 UTC
I haven't investigated the 2nd part of jared description (Also, further testing is needed to confirm that the update works at all, as it seems not to have run at all when I updated my system past 3.09.00.044.)

but this patch at least solves the 1st part !
Comment 4 Paul Poulain 2012-11-21 12:55:23 UTC
(In reply to comment #0)
> Also, further testing is needed to confirm that the update works at all, as
> it seems not to have run at all when I updated my system past 3.09.00.044.

In my database there's no ccode. I've filled some manually, run the queries in the updatedatabase, and it worked well.

The queries also seems correct & logic.

Conclusion = I'm not sure the 2nd part of your description is relevant, more information welcomed if you really think we should investigate more.
Comment 5 Jared Camins-Esakov 2012-11-21 12:58:07 UTC
(In reply to comment #4)
> (In reply to comment #0)
> > Also, further testing is needed to confirm that the update works at all, as
> > it seems not to have run at all when I updated my system past 3.09.00.044.
> 
> In my database there's no ccode. I've filled some manually, run the queries
> in the updatedatabase, and it worked well.
> 
> The queries also seems correct & logic.
> 
> Conclusion = I'm not sure the 2nd part of your description is relevant, more
> information welcomed if you really think we should investigate more.

If the column was created in your database, we can just chalk it up to a momentary glitch on my system. The problem was not that the ccode column wasn't populated correctly. The problem was that the ccode column wasn't created at all.
Comment 6 Paul Poulain 2012-11-21 13:18:41 UTC
(In reply to comment #5)
> If the column was created in your database, we can just chalk it up to a
> momentary glitch on my system. The problem was not that the ccode column
> wasn't populated correctly. The problem was that the ccode column wasn't
> created at all.

yes, it was created on my system. Maybe, you already had the 044 revision, from a patch you'd tested previously, so the updatedatabase was skipped ?
(thanks the new db update mechanism, that will solve this problem ;-) )

let's signoff the patch for the 1st problem then !
Comment 7 Kyle M Hall 2012-11-21 13:21:56 UTC
Created attachment 13576 [details] [review]
Bug 9064: fix statistics.ccode column

From updatedatabase.pl:
    $dbh->do("ALTER TABLE statistics ADD COLUMN ccode VARCHAR ( 10 ) NULL AFTER associatedborrower");
From kohastructure.sql:
  `ccode` int(11) default NULL, -- foreign key from the items table, links transaction to a specific collection code

The variant in updatedatabase.pl is probably what was wanted.

This patch fixes the kohastructure and add another updatedatabase.pl, in case someone has a broken install.
This should not happen, because 3.10.0 still not released, but just in case...

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Comment 8 Jonathan Druart 2012-11-21 15:44:33 UTC
Modify a wrong DB structure

Passed QA.
Comment 9 Jared Camins-Esakov 2012-11-22 14:10:00 UTC
This patch has been pushed to master.
Comment 10 Paul Poulain 2012-11-22 15:41:21 UTC
Patch pushed to branch 3.10.x
Comment 11 Chris Cormack 2013-04-23 10:21:10 UTC
Released in 3.10.0
Comment 12 stiv 2015-06-20 13:04:36 UTC Comment hidden (obsolete)