RED-8561: added sql query to create entities for dossier dictionaries

This commit is contained in:
Ali Oezyetimoglu 2024-03-05 11:42:58 +01:00
parent bc334b9760
commit a37b2dbc32
2 changed files with 14 additions and 0 deletions

View File

@ -183,3 +183,5 @@ databaseChangeLog:
file: db/changelog/tenant/119-set-add-to-all-dossiers-correctly-in-manual-redaction-table.yaml
- include:
file: db/changelog/tenant/120-add-legal-basis-change-to-manual-recategorization.yaml
- include:
file: db/changelog/tenant/sql/205-add-dossier-dictionaries-as-entity.sql

View File

@ -0,0 +1,12 @@
-- SELECT * FROM entity WHERE id NOT LIKE ALL (SELECT e.id || '%' FROM entity e WHERE e.dossier_id IS NULL) AND dossier_id IS NOT NULL;
--
-- INSERT INTO entity
INSERT INTO entity (id, add_to_dictionary_action, description, dossier_id, dossier_template_id, hex_color, is_case_insensitive, is_hint, is_recommendation,
label, rank, type, version, recommendation_hex_color, has_dictionary, system_managed, auto_hide_skipped, soft_deleted_time, skipped_hex_color,
dossier_dictionary_only)
SELECT (SELECT trim(trailing ':' from trim(trailing e.dossier_id from e.id))), e.add_to_dictionary_action, e.description, e.dossier_id, e.dossier_template_id, e.hex_color, e.is_case_insensitive, e.is_hint, e.is_recommendation,
e.label, e.rank, e.type, e.version, e.recommendation_hex_color, e.has_dictionary, e.system_managed, e.auto_hide_skipped, e.soft_deleted_time, e.skipped_hex_color,
e.dossier_dictionary_only
FROM entity e
WHERE (SELECT trim(trailing ':' from trim(trailing e.dossier_id from e.id))) IS NOT NULL;