From 054823ebeb19158d74e923b0e892fc942fcf8436 Mon Sep 17 00:00:00 2001 From: Chris Sharp Date: Thu, 2 Nov 2017 06:56:47 -0400 Subject: [PATCH] 2.12-3.0: move auth reingest to separate file --- .../Pg/version-upgrade/2.12.6-3.0.0-upgrade-db.sql | 129 +++++++++++---------- .../sql/Pg/version-upgrade/post-3.0-upgrade.sql | 48 ++++++++ 2 files changed, 113 insertions(+), 64 deletions(-) create mode 100644 Open-ILS/src/sql/Pg/version-upgrade/post-3.0-upgrade.sql diff --git a/Open-ILS/src/sql/Pg/version-upgrade/2.12.6-3.0.0-upgrade-db.sql b/Open-ILS/src/sql/Pg/version-upgrade/2.12.6-3.0.0-upgrade-db.sql index 434061111a..c135f412bb 100644 --- a/Open-ILS/src/sql/Pg/version-upgrade/2.12.6-3.0.0-upgrade-db.sql +++ b/Open-ILS/src/sql/Pg/version-upgrade/2.12.6-3.0.0-upgrade-db.sql @@ -6809,67 +6809,68 @@ ALTER TABLE biblio.record_entry ENABLE TRIGGER z_opac_vis_mat_view_tgr; COMMIT; -\echo --------------------------------------------------------------------- -\echo Reingest display fields. This can be canceled via Ctrl-C and run at -\echo a later time with the following (or similar) SQL: -\echo -\echo 'SELECT metabib.reingest_metabib_field_entries(id, TRUE, FALSE, TRUE, TRUE, ' -\echo ' (SELECT ARRAY_AGG(id)::INT[] FROM config.metabib_field WHERE display_field))' -\echo ' FROM biblio.record_entry WHERE NOT deleted AND id > 0;' -\echo -\echo Note that if you cancel now, you will also need to do the authority reingest -\echo further down in the upgrade script. - --- REINGEST DISPLAY ENTRIES -SELECT metabib.reingest_metabib_field_entries(id, TRUE, FALSE, TRUE, TRUE, - (SELECT ARRAY_AGG(id)::INT[] FROM config.metabib_field WHERE display_field)) - FROM biblio.record_entry WHERE NOT deleted AND id > 0; - - -\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; +-- PINES: we will run these separately +-- \echo --------------------------------------------------------------------- +-- \echo Reingest display fields. This can be canceled via Ctrl-C and run at +-- \echo a later time with the following (or similar) SQL: +-- \echo +-- \echo 'SELECT metabib.reingest_metabib_field_entries(id, TRUE, FALSE, TRUE, TRUE, ' +-- \echo ' (SELECT ARRAY_AGG(id)::INT[] FROM config.metabib_field WHERE display_field))' +-- \echo ' FROM biblio.record_entry WHERE NOT deleted AND id > 0;' +-- \echo +-- \echo Note that if you cancel now, you will also need to do the authority reingest +-- \echo further down in the upgrade script. +-- +-- -- REINGEST DISPLAY ENTRIES +-- SELECT metabib.reingest_metabib_field_entries(id, TRUE, FALSE, TRUE, TRUE, +-- (SELECT ARRAY_AGG(id)::INT[] FROM config.metabib_field WHERE display_field)) +-- FROM biblio.record_entry WHERE NOT deleted AND id > 0; +-- +-- +-- \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; diff --git a/Open-ILS/src/sql/Pg/version-upgrade/post-3.0-upgrade.sql b/Open-ILS/src/sql/Pg/version-upgrade/post-3.0-upgrade.sql new file mode 100644 index 0000000000..6b14850e54 --- /dev/null +++ b/Open-ILS/src/sql/Pg/version-upgrade/post-3.0-upgrade.sql @@ -0,0 +1,48 @@ +\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; + -- 2.11.0