Bugzilla – Attachment 75245 Details for
Bug 20754
Db revision to remove double accepted list shares
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 20754: Db revision to remove double accepted shares
Bug-11943-Db-revision-to-remove-double-accepted-sh.patch (text/plain), 1.86 KB, created by
Marcel de Rooy
on 2018-05-11 05:48:54 UTC
(
hide
)
Description:
Bug 20754: Db revision to remove double accepted shares
Filename:
MIME Type:
Creator:
Marcel de Rooy
Created:
2018-05-11 05:48:54 UTC
Size:
1.86 KB
patch
obsolete
>From 384b7e684ada96d1e5e9573d9923dd606e02f8ef Mon Sep 17 00:00:00 2001 >From: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >Date: Fri, 4 May 2018 10:42:38 +0200 >Subject: [PATCH] Bug 11943: Db revision to remove double accepted shares >Content-Type: text/plain; charset=utf-8 > >Although it is no problem to have them, we could do a cleanup. >This patch just removes duplicate rows from the table. > >Note: I considered adding a unique index like: > ALTER TABLE virtualshelfshares ADD UNIQUE INDEX (shelfnumber, borrowernumber, invitekey); >But the possible NULL values in borrowernumber and/or invitekey require >additional code changes. So I left it alone. > >Test plan: >[1] Create two records with same borrowernumber and shelfnumber in the shares > table, if not present already. >[2] Run updatedatabase.pl > >Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> > >Signed-off-by: Nick Clemens <nick@bywatersolutions.com> > >Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> >--- > installer/data/mysql/atomicupdate/bug11943.perl | 11 +++++++++++ > 1 file changed, 11 insertions(+) > create mode 100644 installer/data/mysql/atomicupdate/bug11943.perl > >diff --git a/installer/data/mysql/atomicupdate/bug11943.perl b/installer/data/mysql/atomicupdate/bug11943.perl >new file mode 100644 >index 0000000..7f690a5 >--- /dev/null >+++ b/installer/data/mysql/atomicupdate/bug11943.perl >@@ -0,0 +1,11 @@ >+$DBversion = 'XXX'; # will be replaced by the RM >+if( CheckVersion( $DBversion ) ) { >+ # From: https://stackoverflow.com/questions/3311903/remove-duplicate-rows-in-mysql >+ $dbh->do(q| >+DELETE a >+FROM virtualshelfshares as a, virtualshelfshares as b >+WHERE a.id < b.id AND a.borrowernumber IS NOT NULL AND a.borrowernumber=b.borrowernumber AND a.shelfnumber=b.shelfnumber >+ |); >+ SetVersion( $DBversion ); >+ print "Upgrade to $DBversion done (Bug 11943: Remove double accepted list shares)\n"; >+} >-- >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 20754
:
75245
|
102431