1 --Upgrade Script for 2.12.0 to 2.12.1
2 \set eg_version '''2.12.1'''
4 INSERT INTO config.upgrade_log (version, applied_to) VALUES ('2.12.1', :eg_version);
6 SELECT evergreen.upgrade_deps_block_check('1033', :eg_version);
8 -- correctly turn off browsing for subjectd|geograhic and
9 -- subject|temporal now that the *_browse versions exist. This is
10 -- a no-op in a database that was started at version 2.12.0.
11 UPDATE config.metabib_field
12 SET browse_field = FALSE
13 WHERE field_class = 'subject' AND name = 'geographic'
16 UPDATE config.metabib_field
17 SET browse_field = FALSE
18 WHERE field_class = 'subject' AND name = 'temporal'
22 select b.tag, idx.name
23 from authority.control_set_bib_field b
24 join authority.control_set_bib_field_metabib_field_map map on (b.id = map.bib_field)
25 join config.metabib_field idx on (map.metabib_field = idx.id)
28 -- and fix bib field mapping if necessasry
29 UPDATE authority.control_set_bib_field_metabib_field_map map
30 SET metabib_field = cmf.id
31 FROM config.metabib_field cmf
32 WHERE cmf.field_class = 'subject' AND cmf.name= 'temporal_browse'
33 AND map.bib_field IN (
35 FROM authority.control_set_bib_field b
36 JOIN authority.control_set_authority_field a
37 ON (b.authority_field = a.id)
40 AND map.metabib_field IN (
42 FROM config.metabib_field
43 WHERE field_class = 'subject' AND name = 'geographic_browse'
45 UPDATE authority.control_set_bib_field_metabib_field_map map
46 SET metabib_field = cmf.id
47 FROM config.metabib_field cmf
48 WHERE cmf.field_class = 'subject' AND cmf.name= 'geographic_browse'
49 AND map.bib_field IN (
51 FROM authority.control_set_bib_field b
52 JOIN authority.control_set_authority_field a
53 ON (b.authority_field = a.id)
56 AND map.metabib_field IN (
58 FROM config.metabib_field
59 WHERE field_class = 'subject' AND name = 'temporal_browse'
63 \qecho Verify that bib subject fields appear to be mapped to
64 \qecho to correct browse indexes
65 SELECT b.id, b.tag, idx.field_class, idx.name
66 FROM authority.control_set_bib_field b
67 JOIN authority.control_set_bib_field_metabib_field_map map ON (b.id = map.bib_field)
68 JOIN config.metabib_field idx ON (map.metabib_field = idx.id)
73 \qecho This is a browse-only reingest of your bib records. It may take a while.
74 \qecho You may cancel now without losing the effect of the rest of the
75 \qecho upgrade script, and arrange the reingest later.
77 SELECT metabib.reingest_metabib_field_entries(id, TRUE, FALSE, TRUE)
78 FROM biblio.record_entry;