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 ('0716', :eg_version); -- mrpeters/dyrcona
+INSERT INTO config.upgrade_log (version, applied_to) VALUES ('0717', :eg_version); -- eeevil/senator
CREATE TABLE config.bib_source (
id SERIAL PRIMARY KEY,
CREATE TABLE authority.thesaurus (
code TEXT PRIMARY KEY, -- MARC21 thesaurus code
- control_set INT NOT NULL REFERENCES authority.control_set (id) ON UPDATE CASCADE ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED,
+ control_set INT REFERENCES authority.control_set (id) ON UPDATE CASCADE ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED,
name TEXT NOT NULL UNIQUE, -- i18n
description TEXT -- i18n
);
('s', oils_i18n_gettext('s','Sears List of Subject Headings','at','name'), 1),
('v', oils_i18n_gettext('v','Repertoire de vedettes-matiere','at','name'), 1),
('z', oils_i18n_gettext('z','Other','at','name'), 1),
- ('|', oils_i18n_gettext('|','No attempt to code','at','name'), 1);
+ ('|', oils_i18n_gettext('|','No attempt to code','at','name'), NULL);
INSERT INTO action_trigger.hook ( key, core_type, description, passive ) VALUES (
'reservation.available',
--- /dev/null
+-- Evergreen DB patch 0717.data.safer-control-set-defaults.sql
+
+BEGIN;
+
+SELECT evergreen.upgrade_deps_block_check('0717', :eg_version);
+
+-- Allow un-mapped thesauri
+ALTER TABLE authority.thesaurus ALTER COLUMN control_set DROP NOT NULL;
+
+-- Don't tie "No attempt to code" to LoC
+UPDATE authority.thesaurus SET control_set = NULL WHERE code = '|';
+UPDATE authority.record_entry SET control_set = NULL WHERE id IN (SELECT record FROM authority.rec_descriptor WHERE thesaurus = '|');
+
+COMMIT;
SELECT SETVAL('config.coded_value_map_id_seq'::TEXT, (SELECT max(id) FROM config.coded_value_map));
+
+-- Evergreen DB patch 0717.data.safer-control-set-defaults.sql
+
+SELECT evergreen.upgrade_deps_block_check('0717', :eg_version);
+
+-- Allow un-mapped thesauri
+ALTER TABLE authority.thesaurus ALTER COLUMN control_set DROP NOT NULL;
+
+-- Don't tie "No attempt to code" to LoC
+UPDATE authority.thesaurus SET control_set = NULL WHERE code = '|';
+UPDATE authority.record_entry SET control_set = NULL WHERE id IN (SELECT record FROM authority.rec_descriptor WHERE thesaurus = '|');
+
+
COMMIT;
\qecho ************************************************************************
"at", thesaurus,
{"flesh": 1, "flesh_fields": {"at": ["control_set"]}}
);
- _acs_cache_by_at[thesaurus] = at.control_set();
+ var cs;
+ if (at.control_set()) {
+ cs = at.control_set();
+ } else {
+ cs = new fieldmapper.acs();
+ cs.name("None"); // XXX i18n
+
+ }
+ _acs_cache_by_at[thesaurus] = cs;
}
return _acs_cache_by_at[thesaurus];
}