From 8a59b80e7e7cc812c2b1695e75c2020ba9bf3293 Mon Sep 17 00:00:00 2001 From: Tomas Cohen Arazi Date: Mon, 1 Mar 2021 11:56:23 -0300 Subject: [PATCH] Bug 27808: (QA follow-up) Make sure the update catches the items we want This query: SELECT * FROM items LEFT JOIN issues ON issues.itemnumber=items.itemnumber WHERE items.onloan IS NULL; returns 961 rows on the sample data, with 2 items checked out and onloan set to NULL. With this tweak, the query only matches the 2 checkout items with onloan set to NULL: SELECT * FROM items LEFT JOIN issues ON issues.itemnumber=items.itemnumber WHERE items.onloan IS NULL AND issues.issue_id IS NOT NULL; This is the query that needs to be used on the atomic update for filtering the items to be updated. This patch does that. Signed-off-by: Tomas Cohen Arazi Signed-off-by: Jonathan Druart Signed-off-by: Jonathan Druart (cherry picked from commit 8df3e02885f94ef8a6f960f693c398b6646daf09) Signed-off-by: Fridolin Somers --- installer/data/mysql/updatedatabase.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl index fdac64bcd1..775159f8f5 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -23491,7 +23491,7 @@ if( CheckVersion( $DBversion ) ) { UPDATE items LEFT JOIN issues ON issues.itemnumber=items.itemnumber SET items.onloan=CAST(issues.date_due AS DATE) - WHERE items.onloan IS NULL + WHERE items.onloan IS NULL AND issues.issue_id IS NOT NULL |); NewVersion( $DBversion, 27808, "Adjust items.onloan if needed" ); -- 2.39.5