Bugzilla – Attachment 41335 Details for
Bug 14205
Deleting an Item/Record does not remove link to course reserve
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 14205: Deleting an Item/Record does not remove link to course reserve
Bug-14205-Deleting-an-ItemRecord-does-not-remove-l.patch (text/plain), 2.39 KB, created by
Jonathan Druart
on 2015-08-04 09:03:56 UTC
(
hide
)
Description:
Bug 14205: Deleting an Item/Record does not remove link to course reserve
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2015-08-04 09:03:56 UTC
Size:
2.39 KB
patch
obsolete
>From 195d76d9f25c1ac2834c18570e2895004878c6ad Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Tue, 4 Aug 2015 10:00:51 +0100 >Subject: [PATCH] Bug 14205: Deleting an Item/Record does not remove link to > course reserve > >A constraint is missing on the course_reserves.ci_id field. >This patch adds it and removes orphan rows. > >Test plan: >0/ Don't apply the patch >1/ Login to Staff Site. >2/ Go to Course Reserves >3/ Create Course >4/ Add Reserve >5/ Go to item added (delete item/record) >6/ Refresh Course (see no items attached) >7/ Delete Course >8/ See course still listed in the courses (Not deleted) >9/ Apply the patch and execute the updatedatabase entry. >10/ Delete the Course >Note that the course has correctly been removed. >--- > .../mysql/atomicupdate/bug_14205-add_fk_course_reserves_ci_id.sql | 3 +++ > installer/data/mysql/kohastructure.sql | 4 +++- > 2 files changed, 6 insertions(+), 1 deletion(-) > create mode 100644 installer/data/mysql/atomicupdate/bug_14205-add_fk_course_reserves_ci_id.sql > >diff --git a/installer/data/mysql/atomicupdate/bug_14205-add_fk_course_reserves_ci_id.sql b/installer/data/mysql/atomicupdate/bug_14205-add_fk_course_reserves_ci_id.sql >new file mode 100644 >index 0000000..0012ea6 >--- /dev/null >+++ b/installer/data/mysql/atomicupdate/bug_14205-add_fk_course_reserves_ci_id.sql >@@ -0,0 +1,3 @@ >+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; >+ >diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql >index 2409bc2..aaff203 100644 >--- a/installer/data/mysql/kohastructure.sql >+++ b/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` >-- >2.1.0
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 14205
:
41335
|
41390
|
42190
|
42221