TRUE
);
-CREATE OR REPLACE FUNCTION
- config.metabib_representative_field_is_valid(INTEGER, TEXT) RETURNS BOOLEAN AS $$
- SELECT EXISTS (SELECT 1 FROM config.metabib_field WHERE id = $1 AND field_class = $2);
-$$ LANGUAGE SQL STRICT IMMUTABLE;
-
-COMMENT ON FUNCTION config.metabib_representative_field_is_valid(INTEGER, TEXT) IS $$
-Ensure the field_class value on the selected representative field matches
-the class name.
-$$;
-
CREATE TABLE config.metabib_class (
name TEXT PRIMARY KEY,
label TEXT NOT NULL UNIQUE,
b_weight NUMERIC DEFAULT 0.4 NOT NULL,
c_weight NUMERIC DEFAULT 0.2 NOT NULL,
d_weight NUMERIC DEFAULT 0.1 NOT NULL
- representative_field INTEGER REFERENCES config.metabib_field(id),
+ representative_field INTEGER,
CONSTRAINT rep_field_unique UNIQUE(representative_field),
CONSTRAINT rep_field_is_valid CHECK (
representative_field IS NULL OR
CREATE UNIQUE INDEX config_metabib_field_class_name_idx ON config.metabib_field (field_class, name);
+CREATE OR REPLACE FUNCTION
+ config.metabib_representative_field_is_valid(INTEGER, TEXT) RETURNS BOOLEAN AS $$
+ SELECT EXISTS (SELECT 1 FROM config.metabib_field WHERE id = $1 AND field_class = $2);
+$$ LANGUAGE SQL STRICT IMMUTABLE;
+
+COMMENT ON FUNCTION config.metabib_representative_field_is_valid(INTEGER, TEXT) IS $$
+Ensure the field_class value on the selected representative field matches
+the class name.
+$$;
+
+
CREATE TABLE config.ts_config_list (
id TEXT PRIMARY KEY,
name TEXT NOT NULL
WHERE OLD.id = biblio.record_entry.id
);
+ALTER TABLE config.metabib_class ADD CONSTRAINT config_metabib_class_representative_field_pkey FOREIGN KEY (representative_field)
+ REFERENCES config.metabib_field (id) ON DELETE SET NULL DEFERRABLE INITIALLY DEFERRED;
+
ALTER TABLE actor.usr ADD CONSTRAINT actor_usr_mailing_address_fkey FOREIGN KEY (mailing_address) REFERENCES actor.usr_address (id) DEFERRABLE INITIALLY DEFERRED;
ALTER TABLE actor.usr ADD CONSTRAINT actor_usr_billing_address_fkey FOREIGN KEY (billing_address) REFERENCES actor.usr_address (id) DEFERRABLE INITIALLY DEFERRED;
ALTER TABLE actor.usr ADD CONSTRAINT actor_usr_home_ou_fkey FOREIGN KEY (home_ou) REFERENCES actor.org_unit (id) DEFERRABLE INITIALLY DEFERRED;