@@ -, +, @@ remove link to course reserve Tested before (problem existed) and after (problem solved) update. Dropped DB, web installed, and put in dummy data and retested. Problem solved. --- .../mysql/atomicupdate/bug_14205-add_fk_course_reserves_ci_id.sql | 2 ++ installer/data/mysql/kohastructure.sql | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-) create mode 100644 installer/data/mysql/atomicupdate/bug_14205-add_fk_course_reserves_ci_id.sql --- a/installer/data/mysql/atomicupdate/bug_14205-add_fk_course_reserves_ci_id.sql +++ a/installer/data/mysql/atomicupdate/bug_14205-add_fk_course_reserves_ci_id.sql @@ -0,0 +1,2 @@ +DELETE cr.* FROM course_reserves AS cr LEFT JOIN course_items USING(ci_id) WHERE course_items.ci_id IS NULL; +ALTER TABLE course_reserves add CONSTRAINT course_reserves_ibfk_2 FOREIGN KEY (ci_id) REFERENCES course_items (ci_id) ON DELETE CASCADE ON UPDATE CASCADE; --- a/installer/data/mysql/kohastructure.sql +++ a/installer/data/mysql/kohastructure.sql @@ -623,7 +623,9 @@ CREATE TABLE `course_reserves` ( -- Constraints for table `course_reserves` -- ALTER TABLE `course_reserves` - ADD CONSTRAINT `course_reserves_ibfk_1` FOREIGN KEY (`course_id`) REFERENCES `courses` (`course_id`); + ADD CONSTRAINT `course_reserves_ibfk_1` FOREIGN KEY (`course_id`) REFERENCES `courses` (`course_id`), + ADD CONSTRAINT `course_reserves_ibfk_2` FOREIGN KEY (`ci_id`) REFERENCES `course_items` (`ci_id`) ON DELETE CASCADE ON UPDATE CASCADE; + -- -- Table structure for table `branch_borrower_circ_rules` --