Bug 20754: DB revision to remove double accepted shares
authorMarcel de Rooy <m.de.rooy@rijksmuseum.nl>
Fri, 4 May 2018 08:42:38 +0000 (10:42 +0200)
committerLucas Gass <lucas@bywatersolutions.com>
Mon, 11 May 2020 21:22:52 +0000 (15:22 -0600)
commit70447d05deb6cd688d76aaf0f865ea8a8642ff15
treeea54f05fe40c7132b3973c7c7c524e35184f9ada
parenta43184de5e1a048476297541d3adacc14faf4160
Bug 20754: DB revision to remove double accepted shares

[Originally submitted for bug 11943, parked at 20754.]
[Attempt to revive it now.]

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>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Joy Nelson <joy@bywatersolutions.com>
(cherry picked from commit ba3bed7afe84b9e5278bed0aa12d71bfc82b4c9d)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
installer/data/mysql/atomicupdate/bug20754.perl [new file with mode: 0644]