https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=34520
--- Comment #2 from Katrin Fischer <[email protected]> --- 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. _______________________________________________ Koha-bugs mailing list [email protected] https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs website : http://www.koha-community.org/ git : http://git.koha-community.org/ bugs : http://bugs.koha-community.org/
