From 2d5a7d19a3aeca8c192bc9cdb78951a2afcbb615 Mon Sep 17 00:00:00 2001 From: Julian Maurice Date: Fri, 26 Jul 2024 09:16:15 +0200 Subject: [PATCH] Bug 35044: (QA follow-up) Delete empty values with a single query Signed-off-by: Julian Maurice Signed-off-by: Katrin Fischer --- installer/data/mysql/atomicupdate/bug_35044.pl | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/installer/data/mysql/atomicupdate/bug_35044.pl b/installer/data/mysql/atomicupdate/bug_35044.pl index ef12a83f62..2e5d94c272 100755 --- a/installer/data/mysql/atomicupdate/bug_35044.pl +++ b/installer/data/mysql/atomicupdate/bug_35044.pl @@ -42,12 +42,8 @@ return { say $out "Removed UNIQUE KEY `field_record` (`field_id`,`record_id`) from the additional_field_values table"; } - my $additional_fields_values = $dbh->selectall_arrayref(q|SELECT * FROM additional_field_values WHERE value = ''|, { Slice => {} }); - my $number_of_entries = scalar @{$additional_fields_values}; - if ( $number_of_entries ){ - for my $afv (@$additional_fields_values) { - $dbh->do(q{DELETE FROM additional_field_values WHERE value = ''}); - } + my $number_of_entries = $dbh->do(q{DELETE FROM additional_field_values WHERE value = ''}); + if ( defined $number_of_entries && $number_of_entries > 0 ) { say $out "Removed $number_of_entries redundant additional_field_values entries with empty value"; } }, -- 2.39.5