Stamping upgrade script for index corporate authors
authorBen Shum <bshum@biblio.org>
Sun, 23 Dec 2012 20:38:43 +0000 (15:38 -0500)
committerBen Shum <bshum@biblio.org>
Sun, 23 Dec 2012 20:38:43 +0000 (15:38 -0500)
Signed-off-by: Ben Shum <bshum@biblio.org>
Open-ILS/src/sql/Pg/002.schema.config.sql
Open-ILS/src/sql/Pg/upgrade/0749.data.index_corporate_authors.sql [new file with mode: 0644]
Open-ILS/src/sql/Pg/upgrade/XXXX.data.index_corporate_authors.sql [deleted file]

index 196e37f..db3e77e 100644 (file)
@@ -87,7 +87,7 @@ CREATE TRIGGER no_overlapping_deps
     BEFORE INSERT OR UPDATE ON config.db_patch_dependencies
     FOR EACH ROW EXECUTE PROCEDURE evergreen.array_overlap_check ('deprecates');
 
-INSERT INTO config.upgrade_log (version, applied_to) VALUES ('0748', :eg_version); -- dbwells/dbs
+INSERT INTO config.upgrade_log (version, applied_to) VALUES ('0749', :eg_version); -- dbs/bshum
 
 CREATE TABLE config.bib_source (
        id              SERIAL  PRIMARY KEY,
diff --git a/Open-ILS/src/sql/Pg/upgrade/0749.data.index_corporate_authors.sql b/Open-ILS/src/sql/Pg/upgrade/0749.data.index_corporate_authors.sql
new file mode 100644 (file)
index 0000000..a8621d0
--- /dev/null
@@ -0,0 +1,25 @@
+-- Use MARC relator codes (710 subfield 4) to index corporate authors, along
+-- with the existing relator text (710 subfield e)
+
+BEGIN;
+
+-- check whether patch can be applied
+SELECT evergreen.upgrade_deps_block_check('0749', :eg_version);
+
+UPDATE config.metabib_field
+  SET xpath = $$//mods32:mods/mods32:name[@type='corporate'
+    and (mods32:role/mods32:roleTerm[text()='creator']
+      or mods32:role/mods32:roleTerm[text()='aut']
+      or mods32:role/mods32:roleTerm[text()='cre']
+    )]$$
+  WHERE id = 7
+;
+
+SELECT metabib.reingest_metabib_field_entries(record, TRUE, TRUE, FALSE)
+  FROM metabib.full_rec
+  WHERE tag = '710'
+    AND subfield = '4'
+    AND value IN ('cre', 'aut')
+;
+
+COMMIT;
diff --git a/Open-ILS/src/sql/Pg/upgrade/XXXX.data.index_corporate_authors.sql b/Open-ILS/src/sql/Pg/upgrade/XXXX.data.index_corporate_authors.sql
deleted file mode 100644 (file)
index ff41992..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
--- Use MARC relator codes (710 subfield 4) to index corporate authors, along
--- with the existing relator text (710 subfield e)
-
-UPDATE config.metabib_field
-  SET xpath = $$//mods32:mods/mods32:name[@type='corporate'
-    and (mods32:role/mods32:roleTerm[text()='creator']
-      or mods32:role/mods32:roleTerm[text()='aut']
-      or mods32:role/mods32:roleTerm[text()='cre']
-    )]$$
-  WHERE id = 7
-;
-
-SELECT metabib.reingest_metabib_field_entries(record, TRUE, TRUE, FALSE)
-  FROM metabib.full_rec
-  WHERE tag = '710'
-    AND subfield = '4'
-    AND value IN ('cre', 'aut')
-;