From 9c5d09172d6517939a790429bd39dc0d0eb182f9 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Tue, 4 Jul 2023 13:58:34 +0200 Subject: [PATCH] Bug 31383: Fix dbrevs We need to remove duplicate entries. Signed-off-by: Marcel de Rooy Signed-off-by: Martin Renvoize Signed-off-by: Tomas Cohen Arazi --- installer/data/mysql/atomicupdate/bug_31383.pl | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/installer/data/mysql/atomicupdate/bug_31383.pl b/installer/data/mysql/atomicupdate/bug_31383.pl index 3a3d7584f5..0b82581325 100755 --- a/installer/data/mysql/atomicupdate/bug_31383.pl +++ b/installer/data/mysql/atomicupdate/bug_31383.pl @@ -44,6 +44,14 @@ return { for my $translated_content ( @$translated_contents ) { $sth_insert->execute($content->{id}, $translated_content->{title}, $translated_content->{content}, $translated_content->{lang}, $translated_content->{updated_on}); } + + # Delete duplicates + $q = q{ + DELETE FROM additional_contents + WHERE category=? AND code=? AND id<>? AND + }; + $q .= defined $content->{branchcode} ? " branchcode = ?" : " branchcode IS NULL"; + $dbh->do($q, undef, $content->{category}, $content->{code}, $content->{id}, $content->{branchcode}); } $dbh->do(q{ ALTER TABLE additional_contents -- 2.39.5