From: Galen Charlton Date: Wed, 10 Mar 2021 21:21:24 +0000 (-0500) Subject: LP#1917826: tweaks to data update X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=acb2692c2ed91c7a9e9f5b18bcdcab2cbc1468d7;p=evergreen%2Ftadl.git LP#1917826: tweaks to data update - restrict the attribute reingest just to records whose item_type is 'g' - don't break the transaction if a composite attribute definition whose coded_value is 1738 already exists Signed-off-by: Galen Charlton --- diff --git a/Open-ILS/src/sql/Pg/upgrade/XXXX.all_video_search_format.sql b/Open-ILS/src/sql/Pg/upgrade/XXXX.all_video_search_format.sql index 28376367a7..cfb144f21d 100644 --- a/Open-ILS/src/sql/Pg/upgrade/XXXX.all_video_search_format.sql +++ b/Open-ILS/src/sql/Pg/upgrade/XXXX.all_video_search_format.sql @@ -12,15 +12,22 @@ INSERT INTO config.coded_value_map OR value = 'All Videos' OR search_label = 'All Videos' ); -INSERT INTO config.composite_attr_entry_definition (coded_value, definition) VALUES - (1738, '{"_attr":"item_type","_val":"g"}'); +INSERT INTO config.composite_attr_entry_definition (coded_value, definition) + SELECT 1738, '{"_attr":"item_type","_val":"g"}' +WHERE NOT EXISTS ( + SELECT 1 FROM config.composite_attr_entry_definition WHERE coded_value = 1738 +); COMMIT; \qecho -\qecho This is a record attribute reingest of your bib records. -\qecho It will take a while. +\qecho This is a partial record attribute reingest of your bib records. +\qecho It may take a while. \qecho You may cancel now without losing the effect of the rest of the \qecho upgrade script, and arrange the reingest later. -SELECT COUNT(metabib.reingest_record_attributes(id)) - FROM biblio.record_entry WHERE deleted IS FALSE; \ No newline at end of file +SELECT COUNT(metabib.reingest_record_attributes(bre.id)) + FROM biblio.record_entry bre + JOIN metabib.record_attr_flat mraf ON (bre.id = mraf.id) + WHERE deleted IS FALSE + AND attr = 'item_type' + AND value = 'g';