Bugzilla – Attachment 117176 Details for
Bug 27534
koha upgrade throws SQL error while applying Bug 25333 - Change message transport type for Talking Tech from "phone" to "itiva"
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 27534: Add missing ON UPDATE/DELETE clause to message_transport_type_fk
Bug-27534-Add-missing-ON-UPDATEDELETE-clause-to-me.patch (text/plain), 2.14 KB, created by
Martin Renvoize (ashimema)
on 2021-02-23 08:57:20 UTC
(
hide
)
Description:
Bug 27534: Add missing ON UPDATE/DELETE clause to message_transport_type_fk
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2021-02-23 08:57:20 UTC
Size:
2.14 KB
patch
obsolete
>From 7a6ccf426f7084b244576fc3174be388a119e830 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Wed, 27 Jan 2021 09:43:02 +0100 >Subject: [PATCH] Bug 27534: Add missing ON UPDATE/DELETE clause to > message_transport_type_fk > >Bug 9016 (3.15.00.039) added message_transport_type_fk but the ON DELETE >CASCADE ON UPDATE CASCADE clause was missing from the updatedatabase >entry. >If we are upgrading from an old version, 20.06.00.058 will fail on >updating the message_transport_type, with >"Cannot delete or update a parent row: a foreign key constraint fails". > >Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> >--- > installer/data/mysql/updatedatabase.pl | 12 +++++++++++- > 1 file changed, 11 insertions(+), 1 deletion(-) > >diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl >index 4de16f8078..98929e3468 100755 >--- a/installer/data/mysql/updatedatabase.pl >+++ b/installer/data/mysql/updatedatabase.pl >@@ -8300,7 +8300,7 @@ if ( CheckVersion($DBversion) ) { > } ); > > $dbh->do( q{ >- ALTER TABLE letter ADD CONSTRAINT message_transport_type_fk FOREIGN KEY (message_transport_type) REFERENCES message_transport_types(message_transport_type); >+ ALTER TABLE letter ADD CONSTRAINT message_transport_type_fk FOREIGN KEY (message_transport_type) REFERENCES message_transport_types(message_transport_type) ON DELETE CASCADE ON UPDATE CASCADE > } ); > > $dbh->do( q{ >@@ -23191,6 +23191,16 @@ if( CheckVersion( $DBversion ) ) { > > $DBversion = '20.06.00.058'; > if( CheckVersion( $DBversion ) ) { >+ >+ # Adding the ON DELETE CASCASE ON UPDATE CASCADE, in case it's missing (from 9016 - 3.15.00.039) >+ $dbh->do( q{ >+ ALTER TABLE letter DROP FOREIGN KEY message_transport_type_fk >+ } ); >+ >+ $dbh->do( q{ >+ ALTER TABLE letter ADD CONSTRAINT message_transport_type_fk FOREIGN KEY (message_transport_type) REFERENCES message_transport_types(message_transport_type) ON DELETE CASCADE ON UPDATE CASCADE >+ } ); >+ > $dbh->do(q{ > UPDATE message_transport_types SET message_transport_type = "itiva" WHERE message_transport_type = "phone" > }); >-- >2.20.1
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 27534
:
115848
| 117176