From: Chris Sharp Date: Mon, 21 May 2018 12:43:29 +0000 (-0400) Subject: adding auth reingest X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=4c67166db5b47ed0534b12e0a308f6917ca65091;p=evergreen%2Fpines.git adding auth reingest --- diff --git a/Open-ILS/src/sql/Pg/version-upgrade/auth_reingest.sql b/Open-ILS/src/sql/Pg/version-upgrade/auth_reingest.sql new file mode 100644 index 0000000000..af1fbaf098 --- /dev/null +++ b/Open-ILS/src/sql/Pg/version-upgrade/auth_reingest.sql @@ -0,0 +1,47 @@ +\echo --------------------------------------------------------------------- +\echo Reingest authority records. This can be canceled via Ctrl-C and run +\echo at a later time; see the upgrade script. Note that if you cancel now, +\echo you should consult this upgrade script for the reingest actions required. +BEGIN; + +-- add the flag ingest.disable_authority_full_rec if it does not exist +INSERT INTO config.internal_flag (name, enabled) +SELECT 'ingest.disable_authority_full_rec', FALSE +WHERE NOT EXISTS (SELECT 1 FROM config.internal_flag WHERE name = 'ingest.disable_authority_full_rec'); + +CREATE TEMPORARY TABLE internal_flag_state AS + SELECT name, enabled + FROM config.internal_flag + WHERE name in ( + 'ingest.reingest.force_on_same_marc', + 'ingest.disable_authority_auto_update', + 'ingest.disable_authority_full_rec' + ); + +UPDATE config.internal_flag +SET enabled = TRUE +WHERE name in ( + 'ingest.reingest.force_on_same_marc', + 'ingest.disable_authority_auto_update', + 'ingest.disable_authority_full_rec' +); + +ALTER TABLE authority.record_entry DISABLE TRIGGER a_marcxml_is_well_formed; +ALTER TABLE authority.record_entry DISABLE TRIGGER b_maintain_901; +ALTER TABLE authority.record_entry DISABLE TRIGGER c_maintain_control_numbers; +ALTER TABLE authority.record_entry DISABLE TRIGGER map_thesaurus_to_control_set; + +UPDATE authority.record_entry SET id = id WHERE NOT DELETED; + +ALTER TABLE authority.record_entry ENABLE TRIGGER a_marcxml_is_well_formed; +ALTER TABLE authority.record_entry ENABLE TRIGGER b_maintain_901; +ALTER TABLE authority.record_entry ENABLE TRIGGER c_maintain_control_numbers; +ALTER TABLE authority.record_entry ENABLE TRIGGER map_thesaurus_to_control_set; + +-- and restore +UPDATE config.internal_flag a +SET enabled = b.enabled +FROM internal_flag_state b +WHERE a.name = b.name; + +COMMIT;