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 Signed-off-by: Mark Tompsett <mtompset@hotmail.com> Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
This commit is contained in:
parent
ead7d86842
commit
dd88c8f710
1 changed files with 4 additions and 2 deletions
|
@ -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 >= ?");
|
||||
|
|
Loading…
Reference in a new issue