<!-- Actually in the DB -->
+ <class id="vmp" controller="open-ils.cstore open-ils.pcrud" oils_obj:fieldmapper="vandelay::merge_profile" oils_persist:tablename="vandelay.merge_profile" reporter:label="Bib Import Merge Profile">
+ <fields oils_persist:primary="id" oils_persist:sequence="vandelay.import_bib_trash_fields_id_seq">
+ <field reporter:label="Field ID" name="id" reporter:datatype="id"/>
+ <field reporter:label="Owner" name="owner" reporter:datatype="link"/>
+ <field reporter:label="Name" name="name" reporter:datatype="text"/>
+ <field reporter:label="Add Specification" name="add_spec" reporter:datatype="text"/>
+ <field reporter:label="Replace Specification" name="replace_spec" reporter:datatype="text"/>
+ <field reporter:label="Remove Specification" name="strip_spec" reporter:datatype="text"/>
+ <field reporter:label="Preserve Specification" name="preserve_spec" reporter:datatype="text"/>
+ </fields>
+ <links>
+ <link field="owner" reltype="has_a" key="id" map="" class="aou"/>
+ </links>
+ <permacrud xmlns="http://open-ils.org/spec/opensrf/IDL/permacrud/v1">
+ <actions>
+ <create permission="ADMIN_MERGE_PROFILE CREATE_MERGE_PROFILE" context_field="owner"/>
+ <retrieve permission="ADMIN_MERGE_PROFILE CREATE_MERGE_PROFILE UPDATE_MERGE_PROFILE DELETE_MERGE_PROFILE" context_field="owner"/>
+ <update permission="ADMIN_MERGE_PROFILE UPDATE_MERGE_PROFILE" context_field="owner"/>
+ <delete permission="ADMIN_MERGE_PROFILE DELETE_MERGE_PROFILE" context_field="owner"/>
+ </actions>
+ </permacrud>
+ </class>
+
<class id="vibtf" controller="open-ils.cstore open-ils.pcrud" oils_obj:fieldmapper="vandelay::import_bib_trash_fields" oils_persist:tablename="vandelay.import_bib_trash_fields" reporter:label="Import/Overlay Fields for Removal">
<fields oils_persist:primary="id" oils_persist:sequence="vandelay.import_bib_trash_fields_id_seq">
<field reporter:label="Field ID" name="id" reporter:datatype="id"/>
CONSTRAINT vand_import_bib_trash_fields_idx UNIQUE (owner,field)
);
+CREATE TABLE vandelay.merge_profile (
+ id BIGSERIAL PRIMARY KEY,
+ owner INT NOT NULL REFERENCES actor.org_unit (id) ON UPDATE CASCADE ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED,
+ name TEXT NOT NULL,
+ add_spec TEXT,
+ replace_spec TEXT,
+ strip_spec TEXT,
+ preserve_spec TEXT,
+ CONSTRAINT vand_merge_prof_owner_name_idx UNIQUE (owner,name),
+ CONSTRAINT add_replace_strip_or_preserve CHECK (preserve_spec IS NULL OR (add_spec IS NULL AND replace_spec IS NULL AND strip_spec IS NULL))
+);
+
CREATE OR REPLACE FUNCTION vandelay.add_field ( incumbent_xml TEXT, incoming_xml TEXT, field TEXT ) RETURNS TEXT AS $_$
use MARC::Record;
--- /dev/null
+
+BEGIN;
+
+INSERT INTO config.upgrade_log (version) VALUES ('0188'); -- miker
+
+CREATE TABLE vandelay.merge_profile (
+ id BIGSERIAL PRIMARY KEY,
+ owner INT NOT NULL REFERENCES actor.org_unit (id) ON UPDATE CASCADE ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED,
+ name TEXT NOT NULL,
+ add_spec TEXT,
+ replace_spec TEXT,
+ strip_spec TEXT,
+ preserve_spec TEXT,
+ CONSTRAINT vand_merge_prof_owner_name_idx UNIQUE (owner,name),
+ CONSTRAINT add_replace_strip_or_preserve CHECK (preserve_spec IS NULL OR (add_spec IS NULL AND replace_spec IS NULL AND strip_spec IS NULL))
+);
+
+COMMIT;
+