Pull request #369: RED-3716: On adding entries to a dictionary do not read the whole dictionary from persistence

Merge in RED/persistence-service from RED-3716-ps2 to master

* commit 'd837d69153943a62a71f52d9798d4951d44b42b8':
  RED-3716: On adding entries to a dictionary do not read the whole dictionary from persistence
This commit is contained in:
Ali Oezyetimoglu 2022-04-21 16:42:01 +02:00
commit 15e922fff6
2 changed files with 13 additions and 0 deletions

View File

@ -55,5 +55,7 @@ databaseChangeLog:
file: db/changelog/22-add-soft-delete-time-to-entity.changelog.yaml
- include:
file: db/changelog/23-quartz.changelog.yaml
- include:
file: db/changelog/sql/24.0-clean-up-duplicate-dictionary-entries.sql
- include:
file: db/changelog/24-add-unique-constraint-for-dictionary.yaml

View File

@ -0,0 +1,11 @@
delete from dictionary_entry de1 where exists (
select type_id, value from dictionary_entry de2 where de2.type_id = de1.type_id
and de2.value = de1.value and de1.version < de2.version );
delete from dictionary_false_recommendation_entry dfre1 where exists (
select type_id, value from dictionary_false_recommendation_entry dfre2 where dfre2.type_id = dfre1.type_id
and dfre2.value = dfre1.value and dfre1.version < dfre2.version );
delete from dictionary_false_positive_entry dfpe1 where exists (
select type_id, value from dictionary_false_positive_entry dfpe2 where dfpe2.type_id = dfpe1.type_id
and dfpe2.value = dfpe1.value and dfpe1.version < dfpe2.version );