[open-ils-commits] [GIT] Evergreen ILS branch master updated. d3c57a52c97fde378c0766127e72479a93bf83bd
Evergreen Git
git at git.evergreen-ils.org
Wed Sep 27 15:32:57 EDT 2017
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Evergreen ILS".
The branch, master has been updated
via d3c57a52c97fde378c0766127e72479a93bf83bd (commit)
via 8d624a3a77f887b24abaed6497e2b060e33f9581 (commit)
via 4266dbb1521afc764381479ca9b6fd50c8be377d (commit)
via e5a90ff11916f93647a578e8a69268c4d5892f9d (commit)
via 8171d5c3d47229590b98bd7d67c6d6aec05b9fd4 (commit)
via 031d50ddf57072272686d68b5db0f6699f01f359 (commit)
via 0a6ae58650eb11ff270d87268a4ff71fd92da681 (commit)
via d251e7176e2bd50121801a019512049ee9efd16c (commit)
via d388f7019a90a5809514407d7139eb1ed1843432 (commit)
via 0b749e554c3a5c8a93ca36e06e8b587991ab70a3 (commit)
from a0d5e2f731d8cbf3b3b9fffc3726d98f3e5d30e9 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit d3c57a52c97fde378c0766127e72479a93bf83bd
Author: Mike Rylander <mrylander at gmail.com>
Date: Wed Sep 27 14:34:07 2017 -0400
LP#1719726: Make sure all relevant triggers are disabled for bib visibility update
Signed-off-by: Mike Rylander <mrylander at gmail.com>
Signed-off-by: Galen Charlton <gmc at equinoxinitiative.org>
diff --git a/Open-ILS/src/sql/Pg/version-upgrade/2.12.5-3.0-beta1-upgrade-db.sql b/Open-ILS/src/sql/Pg/version-upgrade/2.12.5-3.0-beta1-upgrade-db.sql
index ae619d9..f5454e4 100644
--- a/Open-ILS/src/sql/Pg/version-upgrade/2.12.5-3.0-beta1-upgrade-db.sql
+++ b/Open-ILS/src/sql/Pg/version-upgrade/2.12.5-3.0-beta1-upgrade-db.sql
@@ -7092,6 +7092,7 @@ ALTER TABLE biblio.record_entry DISABLE TRIGGER b_maintain_901;
ALTER TABLE biblio.record_entry DISABLE TRIGGER bbb_simple_rec_trigger;
ALTER TABLE biblio.record_entry DISABLE TRIGGER c_maintain_control_numbers;
ALTER TABLE biblio.record_entry DISABLE TRIGGER fingerprint_tgr;
+ALTER TABLE biblio.record_entry DISABLE TRIGGER z_opac_vis_mat_view_tgr;
UPDATE biblio.record_entry SET vis_attr_vector = biblio.calculate_bib_visibility_attribute_set(id) WHERE NOT DELETED;
@@ -7102,6 +7103,7 @@ ALTER TABLE biblio.record_entry ENABLE TRIGGER b_maintain_901;
ALTER TABLE biblio.record_entry ENABLE TRIGGER bbb_simple_rec_trigger;
ALTER TABLE biblio.record_entry ENABLE TRIGGER c_maintain_control_numbers;
ALTER TABLE biblio.record_entry ENABLE TRIGGER fingerprint_tgr;
+ALTER TABLE biblio.record_entry ENABLE TRIGGER z_opac_vis_mat_view_tgr;
COMMIT;
commit 8d624a3a77f887b24abaed6497e2b060e33f9581
Author: Mike Rylander <mrylander at gmail.com>
Date: Wed Sep 27 14:26:00 2017 -0400
LP#1719726: Retain the ingest.disable_authority_full_rec internal flag if it was missing
Signed-off-by: Mike Rylander <mrylander at gmail.com>
Signed-off-by: Galen Charlton <gmc at equinoxinitiative.org>
diff --git a/Open-ILS/src/sql/Pg/version-upgrade/2.12.5-3.0-beta1-upgrade-db.sql b/Open-ILS/src/sql/Pg/version-upgrade/2.12.5-3.0-beta1-upgrade-db.sql
index df2ac2d..ae619d9 100644
--- a/Open-ILS/src/sql/Pg/version-upgrade/2.12.5-3.0-beta1-upgrade-db.sql
+++ b/Open-ILS/src/sql/Pg/version-upgrade/2.12.5-3.0-beta1-upgrade-db.sql
@@ -7128,6 +7128,11 @@ SELECT metabib.reingest_metabib_field_entries(id, TRUE, FALSE, TRUE, TRUE,
\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
@@ -7137,11 +7142,6 @@ CREATE TEMPORARY TABLE internal_flag_state AS
'ingest.disable_authority_full_rec'
);
--- work around fact that ingest.disable_authority_full_rec may not exist
-INSERT INTO config.internal_flag (name, enabled)
-SELECT 'ingest.disable_authority_full_rec', TRUE
-WHERE NOT EXISTS (SELECT 1 FROM config.internal_flag WHERE name = 'ingest.disable_authority_full_rec');
-
UPDATE config.internal_flag
SET enabled = TRUE
WHERE name in (
@@ -7168,8 +7168,4 @@ SET enabled = b.enabled
FROM internal_flag_state b
WHERE a.name = b.name;
-DELETE FROM config.internal_flag
-WHERE name = 'ingest.disable_authority_full_rec'
-AND NOT EXISTS (SELECT 1 FROM internal_flag_state WHERE name = 'ingest.disable_authority_full_rec');
-
COMMIT;
commit 4266dbb1521afc764381479ca9b6fd50c8be377d
Author: Mike Rylander <mrylander at gmail.com>
Date: Wed Sep 27 14:25:29 2017 -0400
LP#1719726: Baseline trigger definition consistency
Signed-off-by: Mike Rylander <mrylander at gmail.com>
Signed-off-by: Galen Charlton <gmc at equinoxinitiative.org>
diff --git a/Open-ILS/src/sql/Pg/010.schema.biblio.sql b/Open-ILS/src/sql/Pg/010.schema.biblio.sql
index 53ddea5..13620a4 100644
--- a/Open-ILS/src/sql/Pg/010.schema.biblio.sql
+++ b/Open-ILS/src/sql/Pg/010.schema.biblio.sql
@@ -64,7 +64,7 @@ CREATE INDEX biblio_record_entry_fp_idx ON biblio.record_entry ( fingerprint );
CREATE UNIQUE INDEX biblio_record_unique_tcn ON biblio.record_entry (tcn_value) WHERE deleted = FALSE OR deleted IS FALSE;
CREATE TRIGGER a_marcxml_is_well_formed BEFORE INSERT OR UPDATE ON biblio.record_entry FOR EACH ROW EXECUTE PROCEDURE biblio.check_marcxml_well_formed();
CREATE TRIGGER b_maintain_901 BEFORE INSERT OR UPDATE ON biblio.record_entry FOR EACH ROW EXECUTE PROCEDURE evergreen.maintain_901();
-CREATE TRIGGER c_maintain_control_numbers BEFORE INSERT OR UPDATE ON biblio.record_entry FOR EACH ROW EXECUTE PROCEDURE maintain_control_numbers();
+CREATE TRIGGER c_maintain_control_numbers BEFORE INSERT OR UPDATE ON biblio.record_entry FOR EACH ROW EXECUTE PROCEDURE evergreen.maintain_control_numbers();
CREATE TABLE biblio.record_note (
id BIGSERIAL PRIMARY KEY,
diff --git a/Open-ILS/src/sql/Pg/011.schema.authority.sql b/Open-ILS/src/sql/Pg/011.schema.authority.sql
index cf4b75c..6e1e034 100644
--- a/Open-ILS/src/sql/Pg/011.schema.authority.sql
+++ b/Open-ILS/src/sql/Pg/011.schema.authority.sql
@@ -222,7 +222,7 @@ CREATE INDEX authority_record_entry_edit_date_idx ON authority.record_entry ( ed
CREATE INDEX authority_record_deleted_idx ON authority.record_entry(deleted) WHERE deleted IS FALSE OR deleted = false;
CREATE TRIGGER a_marcxml_is_well_formed BEFORE INSERT OR UPDATE ON authority.record_entry FOR EACH ROW EXECUTE PROCEDURE biblio.check_marcxml_well_formed();
CREATE TRIGGER b_maintain_901 BEFORE INSERT OR UPDATE ON authority.record_entry FOR EACH ROW EXECUTE PROCEDURE evergreen.maintain_901();
-CREATE TRIGGER c_maintain_control_numbers BEFORE INSERT OR UPDATE ON authority.record_entry FOR EACH ROW EXECUTE PROCEDURE maintain_control_numbers();
+CREATE TRIGGER c_maintain_control_numbers BEFORE INSERT OR UPDATE ON authority.record_entry FOR EACH ROW EXECUTE PROCEDURE evergreen.maintain_control_numbers();
CREATE TABLE authority.authority_linking (
id BIGSERIAL PRIMARY KEY,
diff --git a/Open-ILS/src/sql/Pg/210.schema.serials.sql b/Open-ILS/src/sql/Pg/210.schema.serials.sql
index 8c65f6f..eac0097 100644
--- a/Open-ILS/src/sql/Pg/210.schema.serials.sql
+++ b/Open-ILS/src/sql/Pg/210.schema.serials.sql
@@ -25,7 +25,7 @@ CREATE INDEX serial_record_entry_creator_idx ON serial.record_entry ( creator );
CREATE INDEX serial_record_entry_editor_idx ON serial.record_entry ( editor );
CREATE INDEX serial_record_entry_owning_lib_idx ON serial.record_entry ( owning_lib, deleted );
CREATE TRIGGER b_maintain_901 BEFORE INSERT OR UPDATE ON serial.record_entry FOR EACH ROW EXECUTE PROCEDURE evergreen.maintain_901();
-CREATE TRIGGER c_maintain_control_numbers BEFORE INSERT OR UPDATE ON serial.record_entry FOR EACH ROW EXECUTE PROCEDURE maintain_control_numbers();
+CREATE TRIGGER c_maintain_control_numbers BEFORE INSERT OR UPDATE ON serial.record_entry FOR EACH ROW EXECUTE PROCEDURE evergreen.maintain_control_numbers();
CREATE RULE protect_mfhd_delete AS ON DELETE TO serial.record_entry DO INSTEAD UPDATE serial.record_entry SET deleted = true WHERE old.id = serial.record_entry.id;
commit e5a90ff11916f93647a578e8a69268c4d5892f9d
Author: Galen Charlton <gmc at equinoxinitiative.org>
Date: Wed Sep 27 12:39:36 2017 -0400
LP#1719726: make config.metabib_field.display_field have same default
Signed-off-by: Galen Charlton <gmc at equinoxinitiative.org>
Signed-off-by: Mike Rylander <mrylander at gmail.com>
Signed-off-by: Galen Charlton <gmc at equinoxinitiative.org>
diff --git a/Open-ILS/src/sql/Pg/002.schema.config.sql b/Open-ILS/src/sql/Pg/002.schema.config.sql
index 6610d59..9fb81da 100644
--- a/Open-ILS/src/sql/Pg/002.schema.config.sql
+++ b/Open-ILS/src/sql/Pg/002.schema.config.sql
@@ -215,7 +215,7 @@ CREATE TABLE config.metabib_field (
authority_xpath TEXT,
joiner TEXT,
restrict BOOL DEFAULT FALSE NOT NULL,
- display_field BOOL NOT NULL DEFAULT TRUE
+ display_field BOOL NOT NULL DEFAULT FALSE
);
COMMENT ON TABLE config.metabib_field IS $$
XPath used for record indexing ingest
commit 8171d5c3d47229590b98bd7d67c6d6aec05b9fd4
Author: Galen Charlton <gmc at equinoxinitiative.org>
Date: Wed Sep 27 12:30:44 2017 -0400
LP#1719726: ensure asset.copy_tag_copy_map has fake FK
Signed-off-by: Galen Charlton <gmc at equinoxinitiative.org>
Signed-off-by: Mike Rylander <mrylander at gmail.com>
Signed-off-by: Galen Charlton <gmc at equinoxinitiative.org>
diff --git a/Open-ILS/src/sql/Pg/040.schema.asset.sql b/Open-ILS/src/sql/Pg/040.schema.asset.sql
index 0faba5f..f9948cb 100644
--- a/Open-ILS/src/sql/Pg/040.schema.asset.sql
+++ b/Open-ILS/src/sql/Pg/040.schema.asset.sql
@@ -977,8 +977,7 @@ CREATE TRIGGER asset_copy_tag_fti_trigger
CREATE TABLE asset.copy_tag_copy_map (
id BIGSERIAL PRIMARY KEY,
- copy BIGINT REFERENCES asset.copy (id)
- ON UPDATE CASCADE ON DELETE CASCADE,
+ copy BIGINT,
tag INTEGER REFERENCES asset.copy_tag (id)
ON UPDATE CASCADE ON DELETE CASCADE
);
diff --git a/Open-ILS/src/sql/Pg/800.fkeys.sql b/Open-ILS/src/sql/Pg/800.fkeys.sql
index 1ee6ead..13129f5 100644
--- a/Open-ILS/src/sql/Pg/800.fkeys.sql
+++ b/Open-ILS/src/sql/Pg/800.fkeys.sql
@@ -145,6 +145,22 @@ CREATE CONSTRAINT TRIGGER inherit_asset_copy_note_copy_fkey
AFTER UPDATE OR INSERT OR DELETE ON asset.copy_note
DEFERRABLE FOR EACH ROW EXECUTE PROCEDURE evergreen.asset_copy_note_owning_copy_inh_fkey();
+CREATE OR REPLACE FUNCTION evergreen.asset_copy_tag_copy_map_copy_inh_fkey() RETURNS TRIGGER AS $f$
+BEGIN
+ PERFORM 1 FROM asset.copy WHERE id = NEW.copy;
+ IF NOT FOUND THEN
+ RAISE foreign_key_violation USING MESSAGE = FORMAT(
+ $$Referenced asset.copy id not found, copy:%s$$, NEW.copy
+ );
+ END IF;
+ RETURN NEW;
+END;
+$f$ LANGUAGE PLPGSQL VOLATILE COST 50;
+
+CREATE CONSTRAINT TRIGGER inherit_asset_copy_tag_copy_map_copy_fkey
+ AFTER UPDATE OR INSERT OR DELETE ON asset.copy_tag_copy_map
+ DEFERRABLE FOR EACH ROW EXECUTE PROCEDURE evergreen.asset_copy_tag_copy_map_copy_inh_fkey();
+
ALTER TABLE asset.copy_note ADD CONSTRAINT asset_copy_note_creator_fkey FOREIGN KEY (creator) REFERENCES actor.usr (id) ON DELETE SET NULL DEFERRABLE INITIALLY DEFERRED;
ALTER TABLE asset.call_number ADD CONSTRAINT asset_call_number_owning_lib_fkey FOREIGN KEY (owning_lib) REFERENCES actor.org_unit (id) DEFERRABLE INITIALLY DEFERRED;
commit 031d50ddf57072272686d68b5db0f6699f01f359
Author: Galen Charlton <gmc at equinoxinitiative.org>
Date: Wed Sep 27 12:25:16 2017 -0400
LP#1719726: make new FK constraint consistent
The constraint fieldset_fieldset_group_fkey will now
do 'ON DELETE CASCADE' regardless of whether the database
was created from scratch or upgraded.
Signed-off-by: Galen Charlton <gmc at equinoxinitiative.org>
Signed-off-by: Mike Rylander <mrylander at gmail.com>
Signed-off-by: Galen Charlton <gmc at equinoxinitiative.org>
diff --git a/Open-ILS/src/sql/Pg/090.schema.action.sql b/Open-ILS/src/sql/Pg/090.schema.action.sql
index 8211b23..7d06aba 100644
--- a/Open-ILS/src/sql/Pg/090.schema.action.sql
+++ b/Open-ILS/src/sql/Pg/090.schema.action.sql
@@ -826,7 +826,7 @@ CREATE TABLE action.fieldset_group (
CREATE TABLE action.fieldset (
id SERIAL PRIMARY KEY,
fieldset_group INT REFERENCES action.fieldset_group (id)
- DEFERRABLE INITIALLY DEFERRED,
+ ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED,
owner INT NOT NULL REFERENCES actor.usr (id)
DEFERRABLE INITIALLY DEFERRED,
owning_lib INT NOT NULL REFERENCES actor.org_unit (id)
commit 0a6ae58650eb11ff270d87268a4ff71fd92da681
Author: Galen Charlton <gmc at equinoxinitiative.org>
Date: Wed Sep 27 12:14:53 2017 -0400
LP#1719726: sync up two authority stored functions
Signed-off-by: Galen Charlton <gmc at equinoxinitiative.org>
Signed-off-by: Mike Rylander <mrylander at gmail.com>
Signed-off-by: Galen Charlton <gmc at equinoxinitiative.org>
diff --git a/Open-ILS/src/sql/Pg/011.schema.authority.sql b/Open-ILS/src/sql/Pg/011.schema.authority.sql
index 4387417..cf4b75c 100644
--- a/Open-ILS/src/sql/Pg/011.schema.authority.sql
+++ b/Open-ILS/src/sql/Pg/011.schema.authority.sql
@@ -295,7 +295,7 @@ BEGIN
IF thes_code IS NULL THEN
thes_code := '|';
ELSIF thes_code = 'z' THEN
- thes_code := COALESCE( oils_xpath_string('//*[@tag="040"]/*[@code="f"][1]', marcxml), '' );
+ thes_code := COALESCE( oils_xpath_string('//*[@tag="040"]/*[@code="f"][1]', marcxml), 'z' );
ELSE
SELECT code INTO thes_code FROM authority.thesaurus WHERE short_code = thes_code;
IF NOT FOUND THEN
@@ -417,6 +417,7 @@ CREATE OR REPLACE FUNCTION authority.simple_heading_set( marcxml TEXT ) RETURNS
DECLARE
res authority.simple_heading%ROWTYPE;
acsaf authority.control_set_authority_field%ROWTYPE;
+ heading_row authority.heading%ROWTYPE;
tag_used TEXT;
nfi_used TEXT;
sf TEXT;
@@ -443,50 +444,58 @@ BEGIN
res.thesaurus := authority.extract_thesaurus(marcxml);
FOR acsaf IN SELECT * FROM authority.control_set_authority_field WHERE control_set = cset LOOP
-
res.atag := acsaf.id;
- tag_used := acsaf.tag;
- nfi_used := acsaf.nfi;
- joiner_text := COALESCE(acsaf.joiner, ' ');
-
- FOR tmp_xml IN SELECT UNNEST(XPATH('//*[@tag="'||tag_used||'"]', marcxml::XML)::TEXT[]) LOOP
-
- heading_text := COALESCE(
- oils_xpath_string('./*[contains("'||acsaf.display_sf_list||'", at code)]', tmp_xml, joiner_text),
- ''
- );
-
- IF nfi_used IS NOT NULL THEN
-
- sort_text := SUBSTRING(
- heading_text FROM
- COALESCE(
- NULLIF(
- REGEXP_REPLACE(
- oils_xpath_string('./@ind'||nfi_used, tmp_xml::TEXT),
- $$\D+$$,
- '',
- 'g'
- ),
- ''
- )::INT,
- 0
- ) + 1
- );
- ELSE
- sort_text := heading_text;
- END IF;
-
- IF heading_text IS NOT NULL AND heading_text <> '' THEN
- res.value := heading_text;
- res.sort_value := public.naco_normalize(sort_text);
+ IF acsaf.heading_field IS NULL THEN
+ tag_used := acsaf.tag;
+ nfi_used := acsaf.nfi;
+ joiner_text := COALESCE(acsaf.joiner, ' ');
+
+ FOR tmp_xml IN SELECT UNNEST(XPATH('//*[@tag="'||tag_used||'"]', marcxml::XML)::TEXT[]) LOOP
+
+ heading_text := COALESCE(
+ oils_xpath_string('./*[contains("'||acsaf.display_sf_list||'", at code)]', tmp_xml, joiner_text),
+ ''
+ );
+
+ IF nfi_used IS NOT NULL THEN
+
+ sort_text := SUBSTRING(
+ heading_text FROM
+ COALESCE(
+ NULLIF(
+ REGEXP_REPLACE(
+ oils_xpath_string('./@ind'||nfi_used, tmp_xml::TEXT),
+ $$\D+$$,
+ '',
+ 'g'
+ ),
+ ''
+ )::INT,
+ 0
+ ) + 1
+ );
+
+ ELSE
+ sort_text := heading_text;
+ END IF;
+
+ IF heading_text IS NOT NULL AND heading_text <> '' THEN
+ res.value := heading_text;
+ res.sort_value := public.naco_normalize(sort_text);
+ res.index_vector = to_tsvector('keyword'::regconfig, res.sort_value);
+ RETURN NEXT res;
+ END IF;
+
+ END LOOP;
+ ELSE
+ FOR heading_row IN SELECT * FROM authority.extract_headings(marcxml, ARRAY[acsaf.heading_field]) LOOP
+ res.value := heading_row.heading;
+ res.sort_value := heading_row.normalized_heading;
res.index_vector = to_tsvector('keyword'::regconfig, res.sort_value);
RETURN NEXT res;
- END IF;
-
- END LOOP;
-
+ END LOOP;
+ END IF;
END LOOP;
RETURN;
commit d251e7176e2bd50121801a019512049ee9efd16c
Author: Galen Charlton <gmc at equinoxinitiative.org>
Date: Tue Sep 26 17:10:10 2017 -0400
LP#1719726: add authority reingest
Signed-off-by: Galen Charlton <gmc at equinoxinitiative.org>
Signed-off-by: Mike Rylander <mrylander at gmail.com>
Signed-off-by: Galen Charlton <gmc at equinoxinitiative.org>
diff --git a/Open-ILS/src/sql/Pg/version-upgrade/2.12.5-3.0-beta1-upgrade-db.sql b/Open-ILS/src/sql/Pg/version-upgrade/2.12.5-3.0-beta1-upgrade-db.sql
index 7fc9b51..df2ac2d 100644
--- a/Open-ILS/src/sql/Pg/version-upgrade/2.12.5-3.0-beta1-upgrade-db.sql
+++ b/Open-ILS/src/sql/Pg/version-upgrade/2.12.5-3.0-beta1-upgrade-db.sql
@@ -7106,13 +7106,15 @@ ALTER TABLE biblio.record_entry ENABLE TRIGGER fingerprint_tgr;
COMMIT;
\echo ---------------------------------------------------------------------
-\echo Reingest display fields. This can ban canceled via Ctrl-C and run at
+\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,
@@ -7120,3 +7122,54 @@ SELECT metabib.reingest_metabib_field_entries(id, TRUE, FALSE, TRUE, TRUE,
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;
+
+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'
+ );
+
+-- work around fact that ingest.disable_authority_full_rec may not exist
+INSERT INTO config.internal_flag (name, enabled)
+SELECT 'ingest.disable_authority_full_rec', TRUE
+WHERE NOT EXISTS (SELECT 1 FROM config.internal_flag WHERE name = '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;
+
+DELETE FROM config.internal_flag
+WHERE name = 'ingest.disable_authority_full_rec'
+AND NOT EXISTS (SELECT 1 FROM internal_flag_state WHERE name = 'ingest.disable_authority_full_rec');
+
+COMMIT;
commit d388f7019a90a5809514407d7139eb1ed1843432
Author: Galen Charlton <gmc at equinoxinitiative.org>
Date: Tue Sep 26 16:07:57 2017 -0400
LP#1719726: adjust computation of bre visibility attribute vector
This patch moves the computation of the visiblity attribute vector
on biblio.record_entry to a separate transaction. Credit to Chris Sharp
for ideas on speeding up this part of the upgrade.
Signed-off-by: Galen Charlton <gmc at equinoxinitiative.org>
Signed-off-by: Mike Rylander <mrylander at gmail.com>
Signed-off-by: Galen Charlton <gmc at equinoxinitiative.org>
diff --git a/Open-ILS/src/sql/Pg/version-upgrade/2.12.5-3.0-beta1-upgrade-db.sql b/Open-ILS/src/sql/Pg/version-upgrade/2.12.5-3.0-beta1-upgrade-db.sql
index 97ca7fa..7fc9b51 100644
--- a/Open-ILS/src/sql/Pg/version-upgrade/2.12.5-3.0-beta1-upgrade-db.sql
+++ b/Open-ILS/src/sql/Pg/version-upgrade/2.12.5-3.0-beta1-upgrade-db.sql
@@ -2564,7 +2564,7 @@ INSERT INTO asset.copy_vis_attr_cache (target_copy, record, vis_attr_vector)
FROM asset.copy cp
JOIN asset.call_number cn ON (cp.call_number = cn.id);
-UPDATE biblio.record_entry SET vis_attr_vector = biblio.calculate_bib_visibility_attribute_set(id);
+-- updating vis cache for biblio.record_entry deferred to end
CREATE TRIGGER z_opac_vis_mat_view_tgr BEFORE INSERT OR UPDATE ON biblio.record_entry FOR EACH ROW EXECUTE PROCEDURE asset.cache_copy_visibility();
CREATE TRIGGER z_opac_vis_mat_view_tgr AFTER INSERT OR DELETE ON biblio.peer_bib_copy_map FOR EACH ROW EXECUTE PROCEDURE asset.cache_copy_visibility();
@@ -7082,6 +7082,30 @@ CREATE TRIGGER c_maintain_control_numbers BEFORE INSERT OR UPDATE ON biblio.reco
COMMIT;
\echo ---------------------------------------------------------------------
+\echo Updating visibility attribute vector for biblio.record_entry
+BEGIN;
+
+ALTER TABLE biblio.record_entry DISABLE TRIGGER a_marcxml_is_well_formed;
+ALTER TABLE biblio.record_entry DISABLE TRIGGER aaa_indexing_ingest_or_delete;
+ALTER TABLE biblio.record_entry DISABLE TRIGGER audit_biblio_record_entry_update_trigger;
+ALTER TABLE biblio.record_entry DISABLE TRIGGER b_maintain_901;
+ALTER TABLE biblio.record_entry DISABLE TRIGGER bbb_simple_rec_trigger;
+ALTER TABLE biblio.record_entry DISABLE TRIGGER c_maintain_control_numbers;
+ALTER TABLE biblio.record_entry DISABLE TRIGGER fingerprint_tgr;
+
+UPDATE biblio.record_entry SET vis_attr_vector = biblio.calculate_bib_visibility_attribute_set(id) WHERE NOT DELETED;
+
+ALTER TABLE biblio.record_entry ENABLE TRIGGER a_marcxml_is_well_formed;
+ALTER TABLE biblio.record_entry ENABLE TRIGGER aaa_indexing_ingest_or_delete;
+ALTER TABLE biblio.record_entry ENABLE TRIGGER audit_biblio_record_entry_update_trigger;
+ALTER TABLE biblio.record_entry ENABLE TRIGGER b_maintain_901;
+ALTER TABLE biblio.record_entry ENABLE TRIGGER bbb_simple_rec_trigger;
+ALTER TABLE biblio.record_entry ENABLE TRIGGER c_maintain_control_numbers;
+ALTER TABLE biblio.record_entry ENABLE TRIGGER fingerprint_tgr;
+
+COMMIT;
+
+\echo ---------------------------------------------------------------------
\echo Reingest display fields. This can ban canceled via Ctrl-C and run at
\echo a later time with the following (or similar) SQL:
\echo
commit 0b749e554c3a5c8a93ca36e06e8b587991ab70a3
Author: Galen Charlton <gmc at equinoxinitiative.org>
Date: Tue Sep 26 16:02:37 2017 -0400
LP#1719726: add 1077 to 3.0-rc1 schema update script
Signed-off-by: Galen Charlton <gmc at equinoxinitiative.org>
Signed-off-by: Mike Rylander <mrylander at gmail.com>
Signed-off-by: Galen Charlton <gmc at equinoxinitiative.org>
diff --git a/Open-ILS/src/sql/Pg/version-upgrade/2.12.5-3.0-beta1-upgrade-db.sql b/Open-ILS/src/sql/Pg/version-upgrade/2.12.5-3.0-beta1-upgrade-db.sql
index e8e585b..97ca7fa 100644
--- a/Open-ILS/src/sql/Pg/version-upgrade/2.12.5-3.0-beta1-upgrade-db.sql
+++ b/Open-ILS/src/sql/Pg/version-upgrade/2.12.5-3.0-beta1-upgrade-db.sql
@@ -6936,6 +6936,148 @@ BEGIN
END;
$f$ LANGUAGE PLPGSQL VOLATILE COST 50;
+SELECT evergreen.upgrade_deps_block_check('1077', :eg_version); -- csharp/gmcharlt
+
+-- if the "public" version of this function exists, drop it to prevent confusion/trouble
+
+-- drop triggers that depend on this first
+DROP TRIGGER IF EXISTS c_maintain_control_numbers ON biblio.record_entry;
+DROP TRIGGER IF EXISTS c_maintain_control_numbers ON serial.record_entry;
+DROP TRIGGER IF EXISTS c_maintain_control_numbers ON authority.record_entry;
+
+DROP FUNCTION IF EXISTS public.maintain_control_numbers();
+
+-- create the function within the "evergreen" schema
+
+CREATE OR REPLACE FUNCTION evergreen.maintain_control_numbers() RETURNS TRIGGER AS $func$
+use strict;
+use MARC::Record;
+use MARC::File::XML (BinaryEncoding => 'UTF-8');
+use MARC::Charset;
+use Encode;
+use Unicode::Normalize;
+
+MARC::Charset->assume_unicode(1);
+
+my $record = MARC::Record->new_from_xml($_TD->{new}{marc});
+my $schema = $_TD->{table_schema};
+my $rec_id = $_TD->{new}{id};
+
+# Short-circuit if maintaining control numbers per MARC21 spec is not enabled
+my $enable = spi_exec_query("SELECT enabled FROM config.global_flag WHERE name = 'cat.maintain_control_numbers'");
+if (!($enable->{processed}) or $enable->{rows}[0]->{enabled} eq 'f') {
+ return;
+}
+
+# Get the control number identifier from an OU setting based on $_TD->{new}{owner}
+my $ou_cni = 'EVRGRN';
+
+my $owner;
+if ($schema eq 'serial') {
+ $owner = $_TD->{new}{owning_lib};
+} else {
+ # are.owner and bre.owner can be null, so fall back to the consortial setting
+ $owner = $_TD->{new}{owner} || 1;
+}
+
+my $ous_rv = spi_exec_query("SELECT value FROM actor.org_unit_ancestor_setting('cat.marc_control_number_identifier', $owner)");
+if ($ous_rv->{processed}) {
+ $ou_cni = $ous_rv->{rows}[0]->{value};
+ $ou_cni =~ s/"//g; # Stupid VIM syntax highlighting"
+} else {
+ # Fall back to the shortname of the OU if there was no OU setting
+ $ous_rv = spi_exec_query("SELECT shortname FROM actor.org_unit WHERE id = $owner");
+ if ($ous_rv->{processed}) {
+ $ou_cni = $ous_rv->{rows}[0]->{shortname};
+ }
+}
+
+my ($create, $munge) = (0, 0);
+
+my @scns = $record->field('035');
+
+foreach my $id_field ('001', '003') {
+ my $spec_value;
+ my @controls = $record->field($id_field);
+
+ if ($id_field eq '001') {
+ $spec_value = $rec_id;
+ } else {
+ $spec_value = $ou_cni;
+ }
+
+ # Create the 001/003 if none exist
+ if (scalar(@controls) == 1) {
+ # Only one field; check to see if we need to munge it
+ unless (grep $_->data() eq $spec_value, @controls) {
+ $munge = 1;
+ }
+ } else {
+ # Delete the other fields, as with more than 1 001/003 we do not know which 003/001 to match
+ foreach my $control (@controls) {
+ $record->delete_field($control);
+ }
+ $record->insert_fields_ordered(MARC::Field->new($id_field, $spec_value));
+ $create = 1;
+ }
+}
+
+my $cn = $record->field('001')->data();
+# Special handling of OCLC numbers, often found in records that lack 003
+if ($cn =~ /^o(c[nm]|n)\d/) {
+ $cn =~ s/^o(c[nm]|n)0*(\d+)/$2/;
+ $record->field('003')->data('OCoLC');
+ $create = 0;
+}
+
+# Now, if we need to munge the 001, we will first push the existing 001/003
+# into the 035; but if the record did not have one (and one only) 001 and 003
+# to begin with, skip this process
+if ($munge and not $create) {
+
+ my $scn = "(" . $record->field('003')->data() . ")" . $cn;
+
+ # Do not create duplicate 035 fields
+ unless (grep $_->subfield('a') eq $scn, @scns) {
+ $record->insert_fields_ordered(MARC::Field->new('035', '', '', 'a' => $scn));
+ }
+}
+
+# Set the 001/003 and update the MARC
+if ($create or $munge) {
+ $record->field('001')->data($rec_id);
+ $record->field('003')->data($ou_cni);
+
+ my $xml = $record->as_xml_record();
+ $xml =~ s/\n//sgo;
+ $xml =~ s/^<\?xml.+\?\s*>//go;
+ $xml =~ s/>\s+</></go;
+ $xml =~ s/\p{Cc}//go;
+
+ # Embed a version of OpenILS::Application::AppUtils->entityize()
+ # to avoid having to set PERL5LIB for PostgreSQL as well
+
+ $xml = NFC($xml);
+
+ # Convert raw ampersands to entities
+ $xml =~ s/&(?!\S+;)/&/gso;
+
+ # Convert Unicode characters to entities
+ $xml =~ s/([\x{0080}-\x{fffd}])/sprintf('&#x%X;',ord($1))/sgoe;
+
+ $xml =~ s/[\x00-\x1f]//go;
+ $_TD->{new}{marc} = $xml;
+
+ return "MODIFY";
+}
+
+return;
+$func$ LANGUAGE PLPERLU;
+
+-- re-create the triggers
+CREATE TRIGGER c_maintain_control_numbers BEFORE INSERT OR UPDATE ON serial.record_entry FOR EACH ROW EXECUTE PROCEDURE evergreen.maintain_control_numbers();
+CREATE TRIGGER c_maintain_control_numbers BEFORE INSERT OR UPDATE ON authority.record_entry FOR EACH ROW EXECUTE PROCEDURE evergreen.maintain_control_numbers();
+CREATE TRIGGER c_maintain_control_numbers BEFORE INSERT OR UPDATE ON biblio.record_entry FOR EACH ROW EXECUTE PROCEDURE evergreen.maintain_control_numbers();
COMMIT;
-----------------------------------------------------------------------
Summary of changes:
Open-ILS/src/sql/Pg/002.schema.config.sql | 2 +-
Open-ILS/src/sql/Pg/010.schema.biblio.sql | 2 +-
Open-ILS/src/sql/Pg/011.schema.authority.sql | 93 +++++----
Open-ILS/src/sql/Pg/040.schema.asset.sql | 3 +-
Open-ILS/src/sql/Pg/090.schema.action.sql | 2 +-
Open-ILS/src/sql/Pg/210.schema.serials.sql | 2 +-
Open-ILS/src/sql/Pg/800.fkeys.sql | 16 ++
.../2.12.5-3.0-beta1-upgrade-db.sql | 221 +++++++++++++++++++-
8 files changed, 291 insertions(+), 50 deletions(-)
hooks/post-receive
--
Evergreen ILS
More information about the open-ils-commits
mailing list