LP#1482757: Amend upgrade script to remove existing orphaned URIs
authorMichele Morgan <mmorgan@noblenet.org>
Fri, 24 Apr 2020 17:03:23 +0000 (13:03 -0400)
committerMichele Morgan <mmorgan@noblenet.org>
Fri, 25 Feb 2022 19:56:36 +0000 (14:56 -0500)
Remove orphaned URIs from the database that have accumulated from past
additions, updates and deletions of records with located URIs.

Signed-off-by: Michele Morgan <mmorgan@noblenet.org>
Signed-off-by: Jason Stephenson <jason@sigio.com>
Signed-off-by: Michele Morgan <mmorgan@noblenet.org>
Open-ILS/src/sql/Pg/upgrade/XXXX.function.biblio.extract_located_uris.sql

index d4c86c7..0737a35 100644 (file)
@@ -141,5 +141,13 @@ BEGIN
 END;
 $func$ LANGUAGE PLPGSQL;
 
+-- Remove existing orphaned URIs from the database.
+DELETE FROM asset.uri
+WHERE id NOT IN
+(
+SELECT uri
+FROM asset.uri_call_number_map
+);
+
 COMMIT;