From fbe63c382d0b70b895e4e2fc6668594549c6cbb4 Mon Sep 17 00:00:00 2001 From: Alexander Watzinger Date: Sat, 10 Aug 2024 17:08:34 +0200 Subject: [PATCH] Update SQL for GND --- install/upgrade/8.6.0.sql | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/install/upgrade/8.6.0.sql b/install/upgrade/8.6.0.sql index 328d08b1b..1a6b6a331 100644 --- a/install/upgrade/8.6.0.sql +++ b/install/upgrade/8.6.0.sql @@ -12,20 +12,18 @@ SELECT 'GND stands for Gemeinsame Normdatei (Integrated Authority File) and offers a broad range of elements to describe authorities.', 'reference_system' WHERE NOT EXISTS ( - SELECT 1 FROM model.entity WHERE name='GND' + SELECT 1 FROM model.entity WHERE name='GND' AND openatlas_class_name = 'reference_system' ); INSERT INTO web.reference_system (system, name, entity_id, resolver_url, website_url, identifier_example) -SELECT +VALUES ( true, 'GND', - (SELECT id FROM model.entity WHERE name = 'GND' AND cidoc_class_code = 'E32'), + (SELECT id FROM model.entity WHERE name = 'GND' AND openatlas_class_name = 'reference_system'), 'https://lobid.org/gnd/', 'https://d-nb.info/standards/elementset/gnd', - '119338467' -WHERE NOT EXISTS ( - SELECT 1 FROM web.reference_system WHERE name='GND' -); + '119338467') +ON CONFLICT (name) DO UPDATE SET resolver_url = 'https://lobid.org/gnd/', system=true; INSERT INTO web.reference_system_openatlas_class (reference_system_id, openatlas_class_name) SELECT (SELECT entity_id FROM web.reference_system WHERE name='GND'), 'person'