Coming from bug 11943
Created attachment 75245 [details] [review] Bug 20754: Db revision to remove double accepted shares [Moved from bug 11943] 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>
It looks like there is a patch with 2 sign-offs... but the status is new? What happened here?
Created attachment 102431 [details] [review] 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>
(In reply to Katrin Fischer from comment #2) > It looks like there is a patch with 2 sign-offs... but the status is new? > What happened here? It came from 11943. Not really clear to me why this really had to be moved at the time. It passed QA. Passing it to RM now for further judgement.
We usually use the following syntax to remove duplicated rows: DELETE t1 FROM table_1 t1 LEFT JOIN table_2 t2 on t1.id=t2.id WHERE t2.id IS NULL;
Nice work everyone! Pushed to master for 20.05
Backported to 19.11.x for 19.11.06
backported to 19.05.x for 19.05.11