Bugzilla – Attachment 45140 Details for
Bug 15207
Error on upgrade from 3.20.5 to 3.22 beta
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 15207: Avoid warnings when adding constraint course_reserves_ibfk_2
Bug-15207-Avoid-warnings-when-adding-constraint-co.patch (text/plain), 2.27 KB, created by
Tomás Cohen Arazi (tcohen)
on 2015-11-25 14:27:17 UTC
(
hide
)
Description:
Bug 15207: Avoid warnings when adding constraint course_reserves_ibfk_2
Filename:
MIME Type:
Creator:
Tomás Cohen Arazi (tcohen)
Created:
2015-11-25 14:27:17 UTC
Size:
2.27 KB
patch
obsolete
>From 174d08328e811f527a4dad5c994718e72b4d0956 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Wed, 25 Nov 2015 13:49:51 +0000 >Subject: [PATCH] Bug 15207: Avoid warnings when adding constraint > course_reserves_ibfk_2 > >Bug 14205 added a new foreign key on the course_reserve table. >As this dbrev has been backported to the stable version (3.20.x), the >next dbrev should take care of this existing constraint to avoid >warnings. > >Test plan: >1/ replace the modified dbrev with 3.21.00.XXX to make sure it will be >executed >2/ Make sure you have the KEY and the FK on the course_reserves table: >sql> 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; >sql> alter table course_reserves ADD KEY `course_reserves_ibfk_2` (`ci_id`); > >3/ SHOW CREATE TABLE course_reserves >should show that the table is not in sync with the kohastructure.sql file >4/ Execute the dbrev >5/ SHOW CREATE TABLE course_reserves >should show that the table is in sync with the kohastructure.sql file > >Repeat 4 and 5, confirm you don't get any error. > >Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> >--- > installer/data/mysql/updatedatabase.pl | 10 +++++++++- > 1 file changed, 9 insertions(+), 1 deletion(-) > >diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl >index 3d52d39..65a2ee2 100755 >--- a/installer/data/mysql/updatedatabase.pl >+++ b/installer/data/mysql/updatedatabase.pl >@@ -10801,9 +10801,17 @@ if ( CheckVersion($DBversion) ) { > LEFT JOIN course_items USING(ci_id) > WHERE course_items.ci_id IS NULL > }); >+ >+ my ($print_error) = $dbh->{PrintError}; >+ $dbh->{RaiseError} = 0; >+ $dbh->{PrintError} = 0; >+ $dbh->do(q{ALTER TABLE course_reserves DROP FOREIGN KEY course_reserves_ibfk_2}); >+ $dbh->do(q{ALTER TABLE course_reserves DROP INDEX course_reserves_ibfk_2}); >+ $dbh->{PrintError} = $print_error; >+ > $dbh->do(q{ > ALTER IGNORE TABLE course_reserves >- add CONSTRAINT course_reserves_ibfk_2 >+ ADD CONSTRAINT course_reserves_ibfk_2 > FOREIGN KEY (ci_id) REFERENCES course_items (ci_id) > ON DELETE CASCADE ON UPDATE CASCADE > }); >-- >2.6.3
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 15207
:
44960
|
44970
|
45021
|
45029
|
45032
|
45066
|
45067
|
45068
|
45113
|
45138
|
45140
|
45142