|
Description
Nick Clemens (kidclamp)
2026-03-11 12:31:19 UTC
*** Bug 42067 has been marked as a duplicate of this bug. *** Created attachment 195123 [details] [review] Bug 42068: Bug 26993 (follow-up) Don't use FOREIGN_KEY_CHECKS To test: 1 - Checkout 25.11.x - reset_all 2 - Enable StoreLastBorrower 3 - Issue an item 4 - Ensure item has a row in items_last_borrower SELECT * FROM items_last_borrower 5 - Checkout main 6 - updatedatabase 7 - Try to delete any item, doesn't have to be the one you issued DELETE FROM items WHERE itemnumber=93; 8 - ERROR 1451 (23000): Cannot delete or update a parent row: a foreign key constraint fails (`koha_kohadev`.`items_last_borrower`, CONSTRAINT `items_last_borrower_ibfk_1` FOREIGN KEY (`itemnumber`) REFERENCES `items` (`itemnumber`) ON DELETE CASCADE ON UPDATE CASCADE) 9 - repeat 1-5 10 - APPLY PATCH 11 - updatedatabase 12 - Try to delete any item 13 - Success! 14 - Delete the item you issued previously (in the staff interface on via mysql) 15 - Confirm no rows in items_last_borrower Created attachment 195125 [details] [review] Bug 42068: Update on bug 26993 breaks items deletions with a corrupted foreign key On bug 26993 we turned off foreign key checks to remove a unique constraint, then enabled them Test plan: 1) Run the db update for bug 42068 2) Attempt to delete an item from Koha or via mysql 3) Note the error 4) Reset your database to pre 42068 5) Apply this patch 6) Run the db update for bug 42068 7) Note you can delete items again! Created attachment 195132 [details] [review] Bug 42068: Bug 26993 (follow-up) Don't use FOREIGN_KEY_CHECKS To test: 1 - Checkout 25.11.x - reset_all 2 - Enable StoreLastBorrower 3 - Issue an item 4 - Ensure item has a row in items_last_borrower SELECT * FROM items_last_borrower 5 - Checkout main 6 - updatedatabase 7 - Try to delete any item, doesn't have to be the one you issued DELETE FROM items WHERE itemnumber=93; 8 - ERROR 1451 (23000): Cannot delete or update a parent row: a foreign key constraint fails (`koha_kohadev`.`items_last_borrower`, CONSTRAINT `items_last_borrower_ibfk_1` FOREIGN KEY (`itemnumber`) REFERENCES `items` (`itemnumber`) ON DELETE CASCADE ON UPDATE CASCADE) 9 - repeat 1-5 10 - APPLY PATCH 11 - updatedatabase 12 - Try to delete any item 13 - Success! 14 - Delete the item you issued previously (in the staff interface on via mysql) 15 - Confirm no rows in items_last_borrower Signed-off-by: Lucas Gass <lucas@bywatersolutions.com> The test plan needs to be: 1 - Checkout main - reset_all this bug doesn't exist in 25.11.x (In reply to Lucas Gass (lukeg) from comment #5) > The test plan needs to be: > > 1 - Checkout main - reset_all > > this bug doesn't exist in 25.11.x Ignore this, I am wrong. Checkout 25.11.x - reset_all you want to do this to go back to before when the bug was present. Not sure whether this is related, it probably comes from another db update via updatedatabase, but still worth logging here: DBIx::Class::Storage::DBI::_dbh_execute(): DBI Exception: DBD::mysql::st execute failed: Unknown column 'me.processfee' in 'field list' at /kohadevbox/koha/Koha/Objects.pm line 401 at /usr/share/perl5/DBIx/Class/Exception.pm line 77 The fix for the bug here works exactly as it should. Created attachment 195136 [details] [review] Bug 42068: Bug 26993 (follow-up) Don't use FOREIGN_KEY_CHECKS To test: 1 - Checkout 25.11.x - reset_all 2 - Enable StoreLastBorrower 3 - Issue an item 4 - Ensure item has a row in items_last_borrower SELECT * FROM items_last_borrower 5 - Checkout main 6 - updatedatabase 7 - Try to delete any item, doesn't have to be the one you issued DELETE FROM items WHERE itemnumber=93; 8 - ERROR 1451 (23000): Cannot delete or update a parent row: a foreign key constraint fails (`koha_kohadev`.`items_last_borrower`, CONSTRAINT `items_last_borrower_ibfk_1` FOREIGN KEY (`itemnumber`) REFERENCES `items` (`itemnumber`) ON DELETE CASCADE ON UPDATE CASCADE) 9 - repeat 1-5 10 - APPLY PATCH 11 - updatedatabase 12 - Try to delete any item 13 - Success! 14 - Delete the item you issued previously (in the staff interface on via mysql) 15 - Confirm no rows in items_last_borrower Signed-off-by: Lucas Gass <lucas@bywatersolutions.com> Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de> |