[Bug 34520] New: Database update 22.06.00.078 breaks update process
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=34520 Bug ID: 34520 Summary: Database update 22.06.00.078 breaks update process Change sponsored?: --- Product: Koha Version: master Hardware: All OS: All Status: NEW Severity: major Priority: P5 - low Component: Installation and upgrade (web-based installer) Assignee: koha-bugs@lists.koha-community.org Reporter: pablo.bianchi@gmail.com QA Contact: testopia@bugs.koha-community.org CC: gmcharlt@gmail.com Trying to upgrade from 22.05.15-1, 10.6.14-MariaDB, Debian 11: Upgrade to 22.06.00.078 [13:21:46]: Bug 24860 - Add ability to place item group level holds ERROR - {UNKNOWN}: DBI Exception: DBD::mysql::db do failed: Can't create table `koha_myinstance`.`reserves` (errno: 150 "Foreign key constraint is incorrectly formed") at /usr/share/koha/lib/C4/Installer.pm line 741 I had some issues (bug 33671 comments 14-19) that it seems are now fixed. -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=34520 Jonathan Druart <jonathan.druart+koha@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Severity|major |critical Depends on| |24860 CC| |jonathan.druart+koha@gmail. | |com, | |kyle@bywatersolutions.com --- Comment #1 from Jonathan Druart <jonathan.druart+koha@gmail.com> --- kohastructure.sql has 5033 CONSTRAINT `reserves_ibfk_ig` FOREIGN KEY (`item_group_id`) REFERENCES `item_groups` (`item_group_id`) ON DELETE CASCADE ON UPDATE CASCADE but db rev (220600078.pl) has: 14 ADD CONSTRAINT `reserves_ibfk_ig` FOREIGN KEY (`item_group_id`) REFERENCES `item_groups` (`item_group_id`) ON DELETE SET NULL ON UPDATE CASCADE; Not sure the error is coming from there however. Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24860 [Bug 24860] Add ability to place item group level holds -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=34520 Katrin Fischer <katrin.fischer@bsz-bw.de> changed: What |Removed |Added ---------------------------------------------------------------------------- Depends on| |24857 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24857 [Bug 24857] Add ability to group items for records -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=34520 --- Comment #2 from Katrin Fischer <katrin.fischer@bsz-bw.de> --- OK, now I totally confused myself here: kohastructure.sql: reserves CONSTRAINT `reserves_ibfk_ig` FOREIGN KEY (`item_group_id`) REFERENCES `item_groups` (`item_group_id`) ON DELETE CASCADE ON UPDATE CASCADE This means, that when the item_group is deleted, we delete the reserve. I think this could create possible issues as we usually should not delete but cancel (move to old_reserves). If we set to null, it turns itself into a title level hold, which seems safer at least. I think SET NULL would make more sense here too. old_reserves CONSTRAINT `old_reserves_ibfk_ig` FOREIGN KEY (`item_group_id`) REFERENCES `item_groups` (`item_group_id`) ON DELETE SET NULL ON UPDATE SET NULL So, when an item_group is deleted, we set it to null in old_reserves. This makes sense, as we would want to keep the entry for hold statistics. Database update: unless ( column_exists( 'reserves', 'item_group_id' ) ) { $dbh->do(q{ ALTER TABLE reserves ADD COLUMN `item_group_id` int(11) NULL default NULL AFTER biblionumber, ADD CONSTRAINT `reserves_ibfk_ig` FOREIGN KEY (`item_group_id`) REFERENCES `item_groups` (`item_group_id`) ON DELETE SET NULL ON UPDATE CASCADE; }); } unless ( column_exists( 'old_reserves', 'item_group_id' ) ) { $dbh->do(q{ ALTER TABLE old_reserves ADD COLUMN `item_group_id` int(11) NULL default NULL AFTER biblionumber, ADD CONSTRAINT `old_reserves_ibfk_ig` FOREIGN KEY (`item_group_id`) REFERENCES `item_groups` (`item_group_id`) ON DELETE SET NULL ON UPDATE SET NULL; }); } I suggest to alter the database definition to fit the original updates. -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=34520 Katrin Fischer <katrin.fischer@bsz-bw.de> changed: What |Removed |Added ---------------------------------------------------------------------------- Patch complexity|--- |Small patch Status|NEW |Needs Signoff -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=34520 --- Comment #3 from Katrin Fischer <katrin.fischer@bsz-bw.de> --- Created attachment 158041 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=158041&action=edit Bug 34520: Fix FK for item_groups in reserves for new installations There was a discrepancy between the database update for reserves and the kohastructure.sql definition. This makes sure that the FK is always "ON DELETE SET NULL". To test: * Before applying this path * sudo koha-mysql kohadev * show create table reserves; CONSTRAINT `reserves_ibfk_ig` FOREIGN KEY (`item_group_id`) REFERENCES `item_groups` (`item_group_id`) ON DELETE CASCADE ON UPDATE CASCADE * Apply patch * Run database update * Check database again: CONSTRAINT `reserves_ibfk_ig` FOREIGN KEY (`item_group_id`) REFERENCES `item_groups` (`item_group_id`) ON DELETE SET NULL ON UPDATE CASCADE * reset_all (create a new database) * Check database again: CONSTRAINT `reserves_ibfk_ig` FOREIGN KEY (`item_group_id`) REFERENCES `item_groups` (`item_group_id`) ON DELETE SET NULL ON UPDATE CASCADE -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=34520 Katrin Fischer <katrin.fischer@bsz-bw.de> changed: What |Removed |Added ---------------------------------------------------------------------------- Assignee|koha-bugs@lists.koha-commun |katrin.fischer@bsz-bw.de |ity.org | -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=34520 --- Comment #4 from Katrin Fischer <katrin.fischer@bsz-bw.de> --- In the end, it wasn't that confusing, but check my patch carefully please :) -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=34520 David Nind <david@davidnind.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Needs Signoff |Signed Off -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=34520 David Nind <david@davidnind.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #158041|0 |1 is obsolete| | --- Comment #5 from David Nind <david@davidnind.com> --- Created attachment 158052 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=158052&action=edit Bug 34520: Fix FK for item_groups in reserves for new installations There was a discrepancy between the database update for reserves and the kohastructure.sql definition. This makes sure that the FK is always "ON DELETE SET NULL". To test: * Before applying this path * sudo koha-mysql kohadev * show create table reserves; CONSTRAINT `reserves_ibfk_ig` FOREIGN KEY (`item_group_id`) REFERENCES `item_groups` (`item_group_id`) ON DELETE CASCADE ON UPDATE CASCADE * Apply patch * Run database update * Check database again: CONSTRAINT `reserves_ibfk_ig` FOREIGN KEY (`item_group_id`) REFERENCES `item_groups` (`item_group_id`) ON DELETE SET NULL ON UPDATE CASCADE * reset_all (create a new database) * Check database again: CONSTRAINT `reserves_ibfk_ig` FOREIGN KEY (`item_group_id`) REFERENCES `item_groups` (`item_group_id`) ON DELETE SET NULL ON UPDATE CASCADE Signed-off-by: David Nind <david@davidnind.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=34520 Nick Clemens <nick@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Signed Off |Passed QA -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=34520 Nick Clemens <nick@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #158052|0 |1 is obsolete| | --- Comment #6 from Nick Clemens <nick@bywatersolutions.com> --- Created attachment 158080 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=158080&action=edit Bug 34520: Fix FK for item_groups in reserves for new installations There was a discrepancy between the database update for reserves and the kohastructure.sql definition. This makes sure that the FK is always "ON DELETE SET NULL". To test: * Before applying this path * sudo koha-mysql kohadev * show create table reserves; CONSTRAINT `reserves_ibfk_ig` FOREIGN KEY (`item_group_id`) REFERENCES `item_groups` (`item_group_id`) ON DELETE CASCADE ON UPDATE CASCADE * Apply patch * Run database update * Check database again: CONSTRAINT `reserves_ibfk_ig` FOREIGN KEY (`item_group_id`) REFERENCES `item_groups` (`item_group_id`) ON DELETE SET NULL ON UPDATE CASCADE * reset_all (create a new database) * Check database again: CONSTRAINT `reserves_ibfk_ig` FOREIGN KEY (`item_group_id`) REFERENCES `item_groups` (`item_group_id`) ON DELETE SET NULL ON UPDATE CASCADE Signed-off-by: David Nind <david@davidnind.com> Signed-off-by: Nick Clemens <nick@bywatersolutions.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=34520 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Version(s)| |23.11.00 released in| | Status|Passed QA |Pushed to master -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=34520 --- Comment #7 from Tomás Cohen Arazi <tomascohen@gmail.com> --- Pushed to master for 23.11. Nice work everyone, thanks! -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=34520 Fridolin Somers <fridolin.somers@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |fridolin.somers@biblibre.co | |m Status|Pushed to master |Pushed to stable Version(s)|23.11.00 |23.11.00,23.05.05 released in| | --- Comment #8 from Fridolin Somers <fridolin.somers@biblibre.com> --- Pushed to 23.05.x for 23.05.05 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=34520 Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Version(s)|23.11.00,23.05.05 |23.11.00,23.05.05,22.11.12 released in| | Status|Pushed to stable |Pushed to oldstable -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=34520 --- Comment #9 from Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com> --- Nice work everyone! Pushed to oldstable for 22.11.x -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=34520 --- Comment #10 from Pablo AB <pablo.bianchi@gmail.com> --- After this bug being fixed, I tried again: Unpacking koha-common (23.05.04-2) over (22.05.16-2) ... [...] Upgrade to 22.06.00.077 [17:29:18]: Bug 31713 - Add ACCOUNTS_SUMMARY slip notice Added new letter 'ACCOUNTS_SUMMARY' (print) Upgrade to 22.06.00.078 [17:29:18]: Bug 24860 - Add ability to place item group level holds ERROR - {UNKNOWN}: DBI Exception: DBD::mysql::db do failed: Can't create table `koha_myinstance`.`#sql-e9_19a4` (errno: 150 "Foreign key constraint is incorrectly formed") at /usr/share/koha/lib/C4/Installer.pm line 741 dpkg: error processing package koha-common (--configure): installed koha-common package post-installation script subprocess returned error exit status 1 I should file a new issue, or this one should be reopened? -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=34520 --- Comment #11 from Jonathan Druart <jonathan.druart+koha@gmail.com> --- (In reply to Matt Blenkinsop from comment #9)
Nice work everyone!
Pushed to oldstable for 22.11.x
Wrong commit commit 2ce9f0ce5b6a0c502f3e329ad80ec85322047257 +$VERSION = "22.11.11.001"; $VERSION = "22.11.11.000"; -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=34520 --- Comment #12 from Jonathan Druart <jonathan.druart+koha@gmail.com> --- (In reply to Pablo AB from comment #10)
I should file a new issue, or this one should be reopened?
Yes, please. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=34520 --- Comment #13 from Jonathan Druart <jonathan.druart+koha@gmail.com> --- Why didn't we fix the problematic DBRev here? -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=34520 Pedro Amorim <pedro.amorim@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |pedro.amorim@ptfs-europe.co | |m --- Comment #14 from Pedro Amorim <pedro.amorim@ptfs-europe.com> --- Thanks Joubu, we fixed it. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=34520 Katrin Fischer <katrin.fischer@bsz-bw.de> changed: What |Removed |Added ---------------------------------------------------------------------------- Blocks| |36424 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=36424 [Bug 36424] Database update 22.06.00.078 breaks update process (II) -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=34520 --- Comment #15 from Katrin Fischer <katrin.fischer@bsz-bw.de> --- (In reply to Pedro Amorim from comment #14)
Thanks Joubu, we fixed it.
I think what Joubu meant was why we didn't fix the original database update too - have to admit I don't know. It looks like another problem popped up on bug 36424 now. -- You are receiving this mail because: You are watching all bug changes.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org