[open-ils-commits] r16617 - in trunk/Open-ILS/src/sql/Pg: . upgrade (miker)
svn at svn.open-ils.org
svn at svn.open-ils.org
Mon Jun 7 14:14:50 EDT 2010
Author: miker
Date: 2010-06-07 14:14:46 -0400 (Mon, 07 Jun 2010)
New Revision: 16617
Added:
trunk/Open-ILS/src/sql/Pg/upgrade/0296.schema.config.metabib_field_fkey.sql
Modified:
trunk/Open-ILS/src/sql/Pg/002.schema.config.sql
trunk/Open-ILS/src/sql/Pg/950.data.seed-values.sql
Log:
Patch from Galen Charlton:
Add foreign key to require that each row in metabib_field has a corresponding XML format.
Modified: trunk/Open-ILS/src/sql/Pg/002.schema.config.sql
===================================================================
--- trunk/Open-ILS/src/sql/Pg/002.schema.config.sql 2010-06-07 17:55:13 UTC (rev 16616)
+++ trunk/Open-ILS/src/sql/Pg/002.schema.config.sql 2010-06-07 18:14:46 UTC (rev 16617)
@@ -65,7 +65,7 @@
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 @@
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
Modified: trunk/Open-ILS/src/sql/Pg/950.data.seed-values.sql
===================================================================
--- trunk/Open-ILS/src/sql/Pg/950.data.seed-values.sql 2010-06-07 17:55:13 UTC (rev 16616)
+++ trunk/Open-ILS/src/sql/Pg/950.data.seed-values.sql 2010-06-07 18:14:46 UTC (rev 16617)
@@ -18,6 +18,13 @@
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 @@
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);
Added: trunk/Open-ILS/src/sql/Pg/upgrade/0296.schema.config.metabib_field_fkey.sql
===================================================================
--- trunk/Open-ILS/src/sql/Pg/upgrade/0296.schema.config.metabib_field_fkey.sql (rev 0)
+++ trunk/Open-ILS/src/sql/Pg/upgrade/0296.schema.config.metabib_field_fkey.sql 2010-06-07 18:14:46 UTC (rev 16617)
@@ -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;
More information about the open-ils-commits
mailing list