[open-ils-commits] [GIT] Evergreen ILS branch master updated. 65307dea427c4e006da6035699ee2201e9065cb0

Evergreen Git git at git.evergreen-ils.org
Fri Jun 6 09:23:12 EDT 2014


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  65307dea427c4e006da6035699ee2201e9065cb0 (commit)
      from  d1cb0e79e74a2c49d297f1f177dd309090e91c14 (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 65307dea427c4e006da6035699ee2201e9065cb0
Author: Dan Wells <dbw2 at calvin.edu>
Date:   Fri Jun 6 09:19:58 2014 -0400

    Forward port 2.5.5 and 2.6.1 upgrade scripts
    
    Signed-off-by: Dan Wells <dbw2 at calvin.edu>

diff --git a/Open-ILS/src/sql/Pg/version-upgrade/2.5.4-2.5.5-upgrade-db.sql b/Open-ILS/src/sql/Pg/version-upgrade/2.5.4-2.5.5-upgrade-db.sql
new file mode 100644
index 0000000..6acfedf
--- /dev/null
+++ b/Open-ILS/src/sql/Pg/version-upgrade/2.5.4-2.5.5-upgrade-db.sql
@@ -0,0 +1,78 @@
+--Upgrade Script for 2.5.4 to 2.5.5
+\set eg_version '''2.5.5'''
+BEGIN;
+INSERT INTO config.upgrade_log (version, applied_to) VALUES ('2.5.5', :eg_version);
+
+SELECT evergreen.upgrade_deps_block_check('0880', :eg_version);
+
+CREATE OR REPLACE FUNCTION authority.calculate_authority_linking(
+    rec_id BIGINT, rec_control_set INT, rec_marc_xml XML
+) RETURNS SETOF authority.authority_linking AS $func$
+DECLARE
+    acsaf       authority.control_set_authority_field%ROWTYPE;
+    link        TEXT;
+    aal         authority.authority_linking%ROWTYPE;
+BEGIN
+    IF rec_control_set IS NULL THEN
+        -- No control_set on record?  Guess at one
+        SELECT control_set INTO rec_control_set
+            FROM authority.control_set_authority_field
+            WHERE tag IN (
+                SELECT UNNEST(
+                    XPATH('//*[starts-with(@tag,"1")]/@tag',rec_marc_xml)::TEXT[]
+                )
+            ) LIMIT 1;
+
+        IF NOT FOUND THEN
+            RAISE WARNING 'Could not even guess at control set for authority record %', rec_id;
+            RETURN;
+        END IF;
+    END IF;
+
+    aal.source := rec_id;
+
+    FOR acsaf IN
+        SELECT * FROM authority.control_set_authority_field
+        WHERE control_set = rec_control_set
+            AND linking_subfield IS NOT NULL
+            AND main_entry IS NOT NULL
+    LOOP
+        -- Loop over the trailing-number contents of all linking subfields
+        FOR link IN
+            SELECT  SUBSTRING( x::TEXT, '\d+$' )
+              FROM  UNNEST(
+                        XPATH(
+                            '//*[@tag="'
+                                || acsaf.tag
+                                || '"]/*[@code="'
+                                || acsaf.linking_subfield
+                                || '"]/text()',
+                            rec_marc_xml
+                        )
+                    ) x
+        LOOP
+
+            -- Ignore links that are null, malformed, circular, or point to
+            -- non-existent authority records.
+            IF link IS NOT NULL AND link::BIGINT <> rec_id THEN
+                PERFORM * FROM authority.record_entry WHERE id = link::BIGINT;
+                IF FOUND THEN
+                    aal.target := link::BIGINT;
+                    aal.field := acsaf.id;
+                    RETURN NEXT aal;
+                END IF;
+            END IF;
+        END LOOP;
+    END LOOP;
+END;
+$func$ LANGUAGE PLPGSQL;
+
+
+
+SELECT evergreen.upgrade_deps_block_check('0881', :eg_version);
+
+UPDATE config.org_unit_setting_type
+    SET description = replace(replace(description,'Original','Physical'),'"ol"','"physical_loc"')
+    WHERE name = 'opac.org_unit_hiding.depth';
+
+COMMIT;
diff --git a/Open-ILS/src/sql/Pg/version-upgrade/2.6.0-2.6.1-upgrade-db.sql b/Open-ILS/src/sql/Pg/version-upgrade/2.6.0-2.6.1-upgrade-db.sql
new file mode 100644
index 0000000..b447697
--- /dev/null
+++ b/Open-ILS/src/sql/Pg/version-upgrade/2.6.0-2.6.1-upgrade-db.sql
@@ -0,0 +1,78 @@
+--Upgrade Script for 2.6.0 to 2.6.1
+\set eg_version '''2.6.1'''
+BEGIN;
+INSERT INTO config.upgrade_log (version, applied_to) VALUES ('2.6.1', :eg_version);
+
+SELECT evergreen.upgrade_deps_block_check('0880', :eg_version);
+
+CREATE OR REPLACE FUNCTION authority.calculate_authority_linking(
+    rec_id BIGINT, rec_control_set INT, rec_marc_xml XML
+) RETURNS SETOF authority.authority_linking AS $func$
+DECLARE
+    acsaf       authority.control_set_authority_field%ROWTYPE;
+    link        TEXT;
+    aal         authority.authority_linking%ROWTYPE;
+BEGIN
+    IF rec_control_set IS NULL THEN
+        -- No control_set on record?  Guess at one
+        SELECT control_set INTO rec_control_set
+            FROM authority.control_set_authority_field
+            WHERE tag IN (
+                SELECT UNNEST(
+                    XPATH('//*[starts-with(@tag,"1")]/@tag',rec_marc_xml)::TEXT[]
+                )
+            ) LIMIT 1;
+
+        IF NOT FOUND THEN
+            RAISE WARNING 'Could not even guess at control set for authority record %', rec_id;
+            RETURN;
+        END IF;
+    END IF;
+
+    aal.source := rec_id;
+
+    FOR acsaf IN
+        SELECT * FROM authority.control_set_authority_field
+        WHERE control_set = rec_control_set
+            AND linking_subfield IS NOT NULL
+            AND main_entry IS NOT NULL
+    LOOP
+        -- Loop over the trailing-number contents of all linking subfields
+        FOR link IN
+            SELECT  SUBSTRING( x::TEXT, '\d+$' )
+              FROM  UNNEST(
+                        XPATH(
+                            '//*[@tag="'
+                                || acsaf.tag
+                                || '"]/*[@code="'
+                                || acsaf.linking_subfield
+                                || '"]/text()',
+                            rec_marc_xml
+                        )
+                    ) x
+        LOOP
+
+            -- Ignore links that are null, malformed, circular, or point to
+            -- non-existent authority records.
+            IF link IS NOT NULL AND link::BIGINT <> rec_id THEN
+                PERFORM * FROM authority.record_entry WHERE id = link::BIGINT;
+                IF FOUND THEN
+                    aal.target := link::BIGINT;
+                    aal.field := acsaf.id;
+                    RETURN NEXT aal;
+                END IF;
+            END IF;
+        END LOOP;
+    END LOOP;
+END;
+$func$ LANGUAGE PLPGSQL;
+
+
+
+SELECT evergreen.upgrade_deps_block_check('0881', :eg_version);
+
+UPDATE config.org_unit_setting_type
+    SET description = replace(replace(description,'Original','Physical'),'"ol"','"physical_loc"')
+    WHERE name = 'opac.org_unit_hiding.depth';
+
+COMMIT;

-----------------------------------------------------------------------

Summary of changes:
 .../2.5.4-2.5.5-upgrade-db.sql}                    |   12 +++++++++++-
 .../2.6.0-2.6.1-upgrade-db.sql}                    |   12 +++++++++++-
 2 files changed, 22 insertions(+), 2 deletions(-)
 copy Open-ILS/src/sql/Pg/{upgrade/0880.function.authority.calculate_authority_linking.sql => version-upgrade/2.5.4-2.5.5-upgrade-db.sql} (85%)
 copy Open-ILS/src/sql/Pg/{upgrade/0880.function.authority.calculate_authority_linking.sql => version-upgrade/2.6.0-2.6.1-upgrade-db.sql} (85%)


hooks/post-receive
-- 
Evergreen ILS


More information about the open-ils-commits mailing list