From: Ben Shum Date: Sun, 23 Dec 2012 20:38:43 +0000 (-0500) Subject: Stamping upgrade script for index corporate authors X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=d5cfac2363f95ea9da5b1f6ad8fa4cad1c53778d;p=evergreen%2Fpines.git Stamping upgrade script for index corporate authors Signed-off-by: Ben Shum --- diff --git a/Open-ILS/src/sql/Pg/002.schema.config.sql b/Open-ILS/src/sql/Pg/002.schema.config.sql index 196e37f2d1..db3e77e3dc 100644 --- a/Open-ILS/src/sql/Pg/002.schema.config.sql +++ b/Open-ILS/src/sql/Pg/002.schema.config.sql @@ -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 index 0000000000..a8621d0047 --- /dev/null +++ b/Open-ILS/src/sql/Pg/upgrade/0749.data.index_corporate_authors.sql @@ -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 index ff41992672..0000000000 --- a/Open-ILS/src/sql/Pg/upgrade/XXXX.data.index_corporate_authors.sql +++ /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') -;