Bug 30481

Summary: Drop unique constraint deleteditemsstocknumberidx for deleteditems
Product: Koha Reporter: Marcel de Rooy <m.de.rooy>
Component: DatabaseAssignee: Marcel de Rooy <m.de.rooy>
Status: Pushed to stable --- QA Contact: Testopia <testopia>
Severity: minor    
Priority: P5 - low CC: kyle, victor
Version: master   
Hardware: All   
OS: All   
See Also: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=23330
Change sponsored?: --- Patch complexity: Trivial patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
22.05.00,21.11.05
Bug Depends on:    
Bug Blocks: 30486    
Attachments: Bug 30481: Drop unique constraint deleteditemsstocknumberidx
Bug 30481: Drop unique constraint deleteditemsstocknumberidx
Bug 30481: Drop unique constraint deleteditemsstocknumberidx

Description Marcel de Rooy 2022-04-07 09:23:45 UTC
Caused by inconsistencies between kohastructure and updatedatabase.
This unique key may be present in older databases.

L3267 ALTER TABLE deleteditems ADD UNIQUE INDEX deleteditemsstocknumberidx (stocknumber);

Note that this comment is not in kohastructure too:
L3264 ALTER TABLE deleteditems ADD stocknumber VARCHAR(32) DEFAULT NULL COMMENT "stores the inventory number of deleted items";
Comment 1 Marcel de Rooy 2022-04-07 09:25:24 UTC
Not sure if deleteditems.enumchron is correct too for older production dbs.
Comment 2 Katrin Fischer 2022-04-07 09:27:44 UTC
It's a rather old issue, actually this is a duplicate to bug 23330 that has some of the history. Closed not too long ago (by me), but I'd actually be quite happy to have this fixed.
Comment 3 Marcel de Rooy 2022-04-07 12:02:53 UTC
Created attachment 133075 [details] [review]
Bug 30481: Drop unique constraint deleteditemsstocknumberidx

Resolves a sync issue between database and schema caused by
differences between structure and upgrades. Note: newer
databases do not contain this index any longer.

Test plan:
Run dbrev.
Check SHOW CREATE TABLE deleteditems.
Verify that unique index has been dropped, regular index added.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Comment 4 Marcel de Rooy 2022-04-07 12:03:12 UTC
Trivial: Self SO
Comment 5 Victor Grousset/tuxayo 2022-04-10 20:59:32 UTC Comment hidden (obsolete)
Comment 6 Victor Grousset/tuxayo 2022-04-10 21:00:17 UTC
Created attachment 133136 [details] [review]
Bug 30481: Drop unique constraint deleteditemsstocknumberidx

Resolves a sync issue between database and schema caused by
differences between structure and upgrades. Note: newer
databases do not contain this index any longer.

Test plan:
Run dbrev.
Check SHOW CREATE TABLE deleteditems.
Verify that unique index has been dropped, regular index added.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Comment 7 Victor Grousset/tuxayo 2022-04-10 21:02:08 UTC
Looks good :)
Comment 8 Fridolin Somers 2022-04-13 13:58:29 UTC
Pushed to master for 22.05, thanks to everybody involved 🦄
Comment 9 Kyle M Hall 2022-04-15 12:08:39 UTC
Pushed to 21.11.x for 21.11.05