From: miker Date: Mon, 7 Jun 2010 18:14:46 +0000 (+0000) Subject: Patch from Galen Charlton: X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=de867e05c0ca48f4ca10724663f68597f612bf6e;p=evergreen%2Fbjwebb.git Patch from Galen Charlton: Add foreign key to require that each row in metabib_field has a corresponding XML format. git-svn-id: svn://svn.open-ils.org/ILS/trunk@16617 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- diff --git a/Open-ILS/src/sql/Pg/002.schema.config.sql b/Open-ILS/src/sql/Pg/002.schema.config.sql index 7d286c5e3..2e2680476 100644 --- a/Open-ILS/src/sql/Pg/002.schema.config.sql +++ b/Open-ILS/src/sql/Pg/002.schema.config.sql @@ -65,7 +65,7 @@ CREATE TABLE config.upgrade_log ( install_date TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW() ); -INSERT INTO config.upgrade_log (version) VALUES ('0295'); -- gmcharlt +INSERT INTO config.upgrade_log (version) VALUES ('0296'); -- gmcharlt CREATE TABLE config.bib_source ( id SERIAL PRIMARY KEY, @@ -207,7 +207,7 @@ CREATE TABLE config.metabib_field ( label TEXT NOT NULL, xpath TEXT NOT NULL, weight INT NOT NULL DEFAULT 1, - format TEXT NOT NULL DEFAULT 'mods33', + format TEXT NOT NULL REFERENCES config.xml_transform (name) DEFAULT 'mods33', search_field BOOL NOT NULL DEFAULT TRUE, facet_field BOOL NOT NULL DEFAULT FALSE, facet_xpath TEXT diff --git a/Open-ILS/src/sql/Pg/950.data.seed-values.sql b/Open-ILS/src/sql/Pg/950.data.seed-values.sql index 8eb73cdc9..bdad1a294 100644 --- a/Open-ILS/src/sql/Pg/950.data.seed-values.sql +++ b/Open-ILS/src/sql/Pg/950.data.seed-values.sql @@ -18,6 +18,13 @@ INSERT INTO config.metabib_class ( name, label ) VALUES ( 'author', oils_i18n_ge INSERT INTO config.metabib_class ( name, label ) VALUES ( 'subject', oils_i18n_gettext('subject', 'Subject', 'cmc', 'name') ); INSERT INTO config.metabib_class ( name, label ) VALUES ( 'series', oils_i18n_gettext('series', 'Series', 'cmc', 'name') ); +-- some more from 002.schema.config.sql: +INSERT INTO config.xml_transform VALUES ( 'marcxml', 'http://www.loc.gov/MARC21/slim', 'marc', '---' ); +INSERT INTO config.xml_transform VALUES ( 'mods', 'http://www.loc.gov/mods/', 'mods', ''); +INSERT INTO config.xml_transform VALUES ( 'mods3', 'http://www.loc.gov/mods/v3', 'mods3', ''); +INSERT INTO config.xml_transform VALUES ( 'mods32', 'http://www.loc.gov/mods/v3', 'mods32', ''); +INSERT INTO config.xml_transform VALUES ( 'mods33', 'http://www.loc.gov/mods/v3', 'mods33', ''); + INSERT INTO config.metabib_field ( id, field_class, name, label, format, xpath, facet_field ) VALUES (1, 'series', 'seriestitle', oils_i18n_gettext(1, 'Series Title', 'cmf', 'label'), 'mods32', $$//mods32:mods/mods32:relatedItem[@type="series"]/mods32:titleInfo$$, TRUE ); @@ -1581,13 +1588,6 @@ SELECT SETVAL('asset.copy_location_id_seq'::TEXT, 100); INSERT INTO asset.call_number VALUES (-1,1,NOW(),1,NOW(),-1,1,'UNCATALOGED'); --- some more from 002.schema.config.sql: -INSERT INTO config.xml_transform VALUES ( 'marcxml', 'http://www.loc.gov/MARC21/slim', 'marc', '---' ); -INSERT INTO config.xml_transform VALUES ( 'mods', 'http://www.loc.gov/mods/', 'mods', ''); -INSERT INTO config.xml_transform VALUES ( 'mods3', 'http://www.loc.gov/mods/v3', 'mods3', ''); -INSERT INTO config.xml_transform VALUES ( 'mods32', 'http://www.loc.gov/mods/v3', 'mods32', ''); -INSERT INTO config.xml_transform VALUES ( 'mods33', 'http://www.loc.gov/mods/v3', 'mods33', ''); - -- circ matrix INSERT INTO config.circ_matrix_matchpoint (org_unit,grp,duration_rule,recurring_fine_rule,max_fine_rule) VALUES (1,1,11,1,1); diff --git a/Open-ILS/src/sql/Pg/upgrade/0296.schema.config.metabib_field_fkey.sql b/Open-ILS/src/sql/Pg/upgrade/0296.schema.config.metabib_field_fkey.sql new file mode 100644 index 000000000..70bf874f9 --- /dev/null +++ b/Open-ILS/src/sql/Pg/upgrade/0296.schema.config.metabib_field_fkey.sql @@ -0,0 +1,7 @@ +BEGIN; + +INSERT INTO config.upgrade_log (version) VALUES ('0296'); --gmc + +ALTER TABLE config.metabib_field ADD CONSTRAINT metabib_field_format_fkey FOREIGN KEY (format) REFERENCES config.xml_transform (name); + +COMMIT;