Bugzilla – Attachment 60202 Details for
Bug 18058
'borrowers-force-messaging-defaults --doit --truncate ' gives DBI error
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 18058: Allow borrower_message_preferences to be truncated
Bug-18058-Allow-borrowermessagepreferences-to-be-t.patch (text/plain), 1.70 KB, created by
Jonathan Druart
on 2017-02-14 14:43:00 UTC
(
hide
)
Description:
Bug 18058: Allow borrower_message_preferences to be truncated
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2017-02-14 14:43:00 UTC
Size:
1.70 KB
patch
obsolete
>From c6a013ca2140b979f24885537ecc089bdd102308 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Tue, 14 Feb 2017 14:39:48 +0000 >Subject: [PATCH] Bug 18058: Allow borrower_message_preferences to be truncated > >borrower_message_preferences cannot be truncated because of the foreign. >DBMS fails with > "Cannot truncate a table referenced in a foreign key constraint" > >To avoid that we should remove the FK check and truncate the other table >as well. > >I am wondering if we really need a truncate here > DELETE FROM borrower_message_preferences; >should do the job, but leave it as it because of the param name. > >Test plan > perl misc/maintenance/borrowers-force-messaging-defaults --doit --truncate >Should no longer raise the error message >--- > misc/maintenance/borrowers-force-messaging-defaults | 6 ++++-- > 1 file changed, 4 insertions(+), 2 deletions(-) > >diff --git a/misc/maintenance/borrowers-force-messaging-defaults b/misc/maintenance/borrowers-force-messaging-defaults >index b0630e1..b17137e 100755 >--- a/misc/maintenance/borrowers-force-messaging-defaults >+++ b/misc/maintenance/borrowers-force-messaging-defaults >@@ -48,8 +48,10 @@ sub force_borrower_messaging_defaults { > $dbh->{AutoCommit} = 0; > > if ( $doit && $truncate ) { >- my $sth = $dbh->prepare("TRUNCATE borrower_message_preferences"); >- $sth->execute(); >+ $dbh->do(q|SET FOREIGN_KEY_CHECKS = 0|); >+ $dbh->do(q|TRUNCATE borrower_message_transport_preferences|); >+ $dbh->do(q|TRUNCATE borrower_message_preferences|); >+ $dbh->do(q|SET FOREIGN_KEY_CHECKS = 1|); > } > > my $sth = $dbh->prepare("SELECT borrowernumber, categorycode FROM borrowers WHERE dateenrolled >= ?"); >-- >2.1.4
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 18058
:
60202
|
60479
|
60985