From a86e1ca364f95b34871d6185a042aeadbdd9cdb2 Mon Sep 17 00:00:00 2001 From: Liz Rea Date: Mon, 21 Sep 2015 14:22:49 +1200 Subject: [PATCH] DBRev 3.18.10.01 --- ...bug_14205-add_fk_course_reserves_ci_id.sql | 2 -- installer/data/mysql/updatedatabase.pl | 19 ++++++++++++++++++- kohaversion.pl | 2 +- 3 files changed, 19 insertions(+), 4 deletions(-) delete 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 deleted file mode 100644 index 1a68545840..0000000000 --- a/installer/data/mysql/atomicupdate/bug_14205-add_fk_course_reserves_ci_id.sql +++ /dev/null @@ -1,2 +0,0 @@ -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/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl index 9e709c12d1..433d446625 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -9854,7 +9854,24 @@ if ( CheckVersion($DBversion) ) { SetVersion ($DBversion); print "Done (3.18.10 release)\n"; } - +$DBversion = "3.18.10.001"; +if ( CheckVersion($DBversion) ) { + print "Bug 14205: Deleting an Item/Record does not remove link to course reserve\n"; + $dbh->do(q{ + DELETE cr.* + FROM course_reserves AS cr + LEFT JOIN course_items USING(ci_id) + WHERE course_items.ci_id IS NULL + }); + $dbh->do(q{ + ALTER IGNORE TABLE course_reserves + add CONSTRAINT course_reserves_ibfk_2 + FOREIGN KEY (ci_id) REFERENCES course_items (ci_id) + ON DELETE CASCADE ON UPDATE CASCADE + }); + print "Upgrade to $DBversion done"; + SetVersion($DBversion); +} =head1 FUNCTIONS diff --git a/kohaversion.pl b/kohaversion.pl index 8b49e6cdcc..65bdba8c27 100644 --- a/kohaversion.pl +++ b/kohaversion.pl @@ -17,7 +17,7 @@ the kohaversion is divided in 4 parts : use strict; sub kohaversion { - our $VERSION = '3.18.10.000'; + our $VERSION = '3.18.10.001'; # version needs to be set this way # so that it can be picked up by Makefile.PL # during install -- 2.39.5