Bug 31383: Fix dbrevs
We need to remove duplicate entries. Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
This commit is contained in:
parent
84368f6d39
commit
9c5d09172d
1 changed files with 8 additions and 0 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue