Bug 14978 - issues.itemnumber should be a unique key
Summary: issues.itemnumber should be a unique key
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Architecture, internals, and plumbing (show other bugs)
Version: master
Hardware: All All
: P5 - low normal (vote)
Assignee: Jonathan Druart
QA Contact: Testopia
URL:
Whiteboard:
Keywords:
: 15677 (view as bug list)
Depends on: 14069
Blocks: 15462 16534
  Show dependency treegraph
 
Reported: 2015-10-08 07:52 UTC by Jonathan Druart
Modified: 2016-12-05 21:26 UTC (History)
6 users (show)

See Also:
Change sponsored?: ---
Patch complexity: Trivial patch
Bot Control: ---
When did the bot last check this:
Who signed the patch off:
Text to go in the release notes:


Attachments
Bug 14978: Add unique key constraint on issues.itemnumber (2.22 KB, patch)
2015-10-08 08:19 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 14978: Add unique key constraint on issues.itemnumber (2.36 KB, patch)
2015-10-12 15:29 UTC, Marc Véron
Details | Diff | Splinter Review
[PASSED QA] Bug 14978: Add unique key constraint on issues.itemnumber (2.44 KB, patch)
2015-10-30 18:18 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 Jonathan Druart 2015-10-08 07:52:10 UTC
Bug 14069 removed existing primary key on issues without questioning why one could exist.
Note that the primary key was not in the kohastructure.sql and only existed on old DB.

issues.itemnumber should be a unique key to avoid duplication of issues on the same item.
Comment 1 Jonathan Druart 2015-10-08 08:19:09 UTC Comment hidden (obsolete)
Comment 2 Marc Véron 2015-10-12 15:29:58 UTC Comment hidden (obsolete)
Comment 3 Kyle M Hall 2015-10-30 18:18:13 UTC
Created attachment 44246 [details] [review]
[PASSED QA] Bug 14978: Add unique key constraint on issues.itemnumber

The constraint might have existed before bug 14069.
For these DB, this patch will restore it, for others, it will add it :)

Test plan:
> show create table issues;
should not return "unique key itemnumber"
Execute the updatedb entry twice
> show create table issues;
should return only one "unique key itemnumber"

Signed-off-by: Marc Véron <veron@veron.ch>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Comment 4 Tomás Cohen Arazi 2015-11-02 16:05:19 UTC
Patch pushed to master.

Thanks Jonathan!
Comment 5 Frédéric Demians 2015-11-27 06:52:03 UTC
Does this patch need to be backported to 3.20.x?
Comment 6 Jonathan Druart 2015-12-01 09:50:36 UTC
(In reply to Frédéric Demians from comment #5)
> Does this patch need to be backported to 3.20.x?

As bug 14069 is in 3.20.x I would say yes.
Comment 7 Frédéric Demians 2015-12-02 07:57:18 UTC
This patch has been pushed to 3.20.x, will be in 3.20.7.
Comment 8 Katrin Fischer 2015-12-02 22:32:36 UTC
Do we need to change the database update statements in later versions now to avoid errors/warnings?
Comment 9 Katrin Fischer 2015-12-02 22:33:31 UTC
Ah, I see it already includes a check for existence - so should be safe :)
Comment 10 Jonathan Druart 2016-02-15 17:37:20 UTC
*** Bug 15677 has been marked as a duplicate of this bug. ***