Bugzilla – Attachment 120241 Details for
Bug 27842
Incorrect biblionumber handling in serials subscriptions
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 27842: (follow-up) Correct existing serail/subscriptionhistory before deletion
Bug-27842-follow-up-Correct-existing-serailsubscri.patch (text/plain), 2.16 KB, created by
Tomás Cohen Arazi (tcohen)
on 2021-04-27 14:44:11 UTC
(
hide
)
Description:
Bug 27842: (follow-up) Correct existing serail/subscriptionhistory before deletion
Filename:
MIME Type:
Creator:
Tomás Cohen Arazi (tcohen)
Created:
2021-04-27 14:44:11 UTC
Size:
2.16 KB
patch
obsolete
>From 968f805c52d65492027ea0a302a8203c0dd52789 Mon Sep 17 00:00:00 2001 >From: Nick Clemens <nick@bywatersolutions.com> >Date: Thu, 4 Mar 2021 12:42:59 +0000 >Subject: [PATCH] Bug 27842: (follow-up) Correct existing > serail/subscriptionhistory before deletion > >Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> >--- > installer/data/mysql/updatedatabase.pl | 12 ++++++++++++ > 1 file changed, 12 insertions(+) > >diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl >index d4f2e904ca1..02defac2efc 100755 >--- a/installer/data/mysql/updatedatabase.pl >+++ b/installer/data/mysql/updatedatabase.pl >@@ -21703,6 +21703,15 @@ if( CheckVersion( $DBversion ) ) { > > unless ( foreign_key_exists( 'serial', 'serial_ibfk_1' ) ) { > my $serials = $dbh->selectall_arrayref(q| >+ SELECT serialid FROM serial JOIN subscription USING (subscriptionid) WHERE serial.biblionumber != subscription.biblionumber >+ |, { Slice => {} }); >+ if ( @$serials ) { >+ push @warnings, q|WARNING - The following serials will be updated, they were attached to a different biblionumber than their related subscription: | . join ", ", map { $_->{serialid} } @$serials; >+ $dbh->do(q| >+ UPDATE serial JOIN subscription USING (subcriptionid) SET serial.biblionumber = subscription.biblionumber WHERE serial.biblionumber != subscription.biblionumber >+ |); >+ } >+ $serials = $dbh->selectall_arrayref(q| > SELECT serialid FROM serial WHERE biblionumber NOT IN (SELECT biblionumber FROM biblio) > |, { Slice => {} }); > if ( @$serials ) { >@@ -21745,6 +21754,9 @@ if( CheckVersion( $DBversion ) ) { > |); > > unless ( foreign_key_exists( 'subscriptionhistory', 'subscription_history_ibfk_1' ) ) { >+ $dbh->do(q| >+ UPDATE subscriptionhistory JOIN subscription USING (subcriptionid) SET subscriptionhistory.biblionumber = subscription.biblionumber WHERE subscriptionhistory.biblionumber != subscription.biblionumber >+ |); > $dbh->do(q| > DELETE FROM subscriptionhistory WHERE biblionumber NOT IN (SELECT biblionumber FROM biblio) > |); >-- >2.31.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 27842
:
117565
|
117566
|
117567
|
117677
|
117696
|
117697
|
117698
|
117712
|
120239
|
120240
| 120241