Upgrade to 22.05.04.002 [14:07:01]: Bug 31086 - Do not allow null values in branchcodes for reserves ERROR: {UNKNOWN}: DBI Exception: DBD::mysql::db do failed: Cannot change column 'branchcode': used in a foreign key constraint 'reserves_ibfk_4' at /usr/share/koha/lib/C4/Installer.pm line 739
Created attachment 141336 [details] [review] Bug 31673: (bug 31086 follow-up) Drop and constraint to allow updating column It seems that we cannot edit the column while it has a constraint. If we remove it, update the oclumn, then re-add it, the update succeeds
To help those who don't use diff, I have extracted the relevant sql to the following: ALTER TABLE reserves DROP FOREIGN KEY reserves_ibfk_4; ALTER TABLE reserves MODIFY COLUMN `branchcode` VARCHAR(10) COLLATE utf8mb4_unicode_ci NOT NULL; ALTER TABLE reserves ADD CONSTRAINT reserves_ibfk_4 FOREIGN KEY (branchcode) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE;
This works.. I'm just marking it PQA as people don't appear to want to put their names to it. SO + QA Done
Created attachment 141512 [details] [review] Bug 31673: (bug 31086 follow-up) Drop and constraint to allow updating column It seems that we cannot edit the column while it has a constraint. If we remove it, update the oclumn, then re-add it, the update succeeds Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Created attachment 141599 [details] [review] Bug 31673: (QA follow-up) Check if FK exists before attempt to remove Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Pushed to master for 22.11. Nice work everyone, thanks!
Backported to 22.05.x for upcoming 22.05.06 release
Missing dependencies for 21.05.x, it shouldn't be affected, no backport. Dodged a bullet again :P
Thanks! Pushed to 21.11 for 21.11.12