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 ('1021', :eg_version); -- Jboyer/kmlussier
+INSERT INTO config.upgrade_log (version, applied_to) VALUES ('1023', :eg_version); -- gmcharlt/kmlussier
CREATE TABLE config.bib_source (
id SERIAL PRIMARY KEY,
--- /dev/null
+BEGIN;
+
+SELECT evergreen.upgrade_deps_block_check('1022', :eg_version);
+
+CREATE OR REPLACE FUNCTION vandelay.merge_record_xml_using_profile ( incoming_marc TEXT, existing_marc TEXT, merge_profile_id BIGINT ) RETURNS TEXT AS $$
+DECLARE
+ merge_profile vandelay.merge_profile%ROWTYPE;
+ dyn_profile vandelay.compile_profile%ROWTYPE;
+ target_marc TEXT;
+ source_marc TEXT;
+ replace_rule TEXT;
+ match_count INT;
+BEGIN
+
+ IF existing_marc IS NULL OR incoming_marc IS NULL THEN
+ -- RAISE NOTICE 'no marc for source or target records';
+ RETURN NULL;
+ END IF;
+
+ IF merge_profile_id IS NOT NULL THEN
+ SELECT * INTO merge_profile FROM vandelay.merge_profile WHERE id = merge_profile_id;
+ IF FOUND THEN
+ dyn_profile.add_rule := COALESCE(merge_profile.add_spec,'');
+ dyn_profile.strip_rule := COALESCE(merge_profile.strip_spec,'');
+ dyn_profile.replace_rule := COALESCE(merge_profile.replace_spec,'');
+ dyn_profile.preserve_rule := COALESCE(merge_profile.preserve_spec,'');
+ ELSE
+ -- RAISE NOTICE 'merge profile not found';
+ RETURN NULL;
+ END IF;
+ ELSE
+ -- RAISE NOTICE 'no merge profile specified';
+ RETURN NULL;
+ END IF;
+
+ IF dyn_profile.replace_rule <> '' AND dyn_profile.preserve_rule <> '' THEN
+ -- RAISE NOTICE 'both replace [%] and preserve [%] specified', dyn_profile.replace_rule, dyn_profile.preserve_rule;
+ RETURN NULL;
+ END IF;
+
+ IF dyn_profile.replace_rule = '' AND dyn_profile.preserve_rule = '' AND dyn_profile.add_rule = '' AND dyn_profile.strip_rule = '' THEN
+ -- Since we have nothing to do, just return a target record as is
+ RETURN existing_marc;
+ ELSIF dyn_profile.preserve_rule <> '' THEN
+ source_marc = existing_marc;
+ target_marc = incoming_marc;
+ replace_rule = dyn_profile.preserve_rule;
+ ELSE
+ source_marc = incoming_marc;
+ target_marc = existing_marc;
+ replace_rule = dyn_profile.replace_rule;
+ END IF;
+
+ RETURN vandelay.merge_record_xml( target_marc, source_marc, dyn_profile.add_rule, replace_rule, dyn_profile.strip_rule );
+
+END;
+$$ LANGUAGE PLPGSQL;
+
+COMMIT;
--- /dev/null
+BEGIN;
+
+SELECT evergreen.upgrade_deps_block_check('1023', :eg_version);
+
+INSERT into config.org_unit_setting_type
+( name, grp, label, description, datatype, fm_class ) VALUES
+(
+ 'cat.default_merge_profile', 'cat',
+ oils_i18n_gettext(
+ 'cat.default_merge_profile',
+ 'Default Merge Profile (Z39.50 and Record Buckets)',
+ 'coust',
+ 'label'
+ ),
+ oils_i18n_gettext(
+ 'cat.default_merge_profile',
+ 'Default merge profile to use during Z39.50 imports and record bucket merges',
+ 'coust',
+ 'description'
+ ),
+ 'link',
+ 'vmp'
+);
+
+COMMIT;
+++ /dev/null
-BEGIN;
-
--- SELECT evergreen.upgrade_deps_block_check('XXXX', :eg_version);
-
-CREATE OR REPLACE FUNCTION vandelay.merge_record_xml_using_profile ( incoming_marc TEXT, existing_marc TEXT, merge_profile_id BIGINT ) RETURNS TEXT AS $$
-DECLARE
- merge_profile vandelay.merge_profile%ROWTYPE;
- dyn_profile vandelay.compile_profile%ROWTYPE;
- target_marc TEXT;
- source_marc TEXT;
- replace_rule TEXT;
- match_count INT;
-BEGIN
-
- IF existing_marc IS NULL OR incoming_marc IS NULL THEN
- -- RAISE NOTICE 'no marc for source or target records';
- RETURN NULL;
- END IF;
-
- IF merge_profile_id IS NOT NULL THEN
- SELECT * INTO merge_profile FROM vandelay.merge_profile WHERE id = merge_profile_id;
- IF FOUND THEN
- dyn_profile.add_rule := COALESCE(merge_profile.add_spec,'');
- dyn_profile.strip_rule := COALESCE(merge_profile.strip_spec,'');
- dyn_profile.replace_rule := COALESCE(merge_profile.replace_spec,'');
- dyn_profile.preserve_rule := COALESCE(merge_profile.preserve_spec,'');
- ELSE
- -- RAISE NOTICE 'merge profile not found';
- RETURN NULL;
- END IF;
- ELSE
- -- RAISE NOTICE 'no merge profile specified';
- RETURN NULL;
- END IF;
-
- IF dyn_profile.replace_rule <> '' AND dyn_profile.preserve_rule <> '' THEN
- -- RAISE NOTICE 'both replace [%] and preserve [%] specified', dyn_profile.replace_rule, dyn_profile.preserve_rule;
- RETURN NULL;
- END IF;
-
- IF dyn_profile.replace_rule = '' AND dyn_profile.preserve_rule = '' AND dyn_profile.add_rule = '' AND dyn_profile.strip_rule = '' THEN
- -- Since we have nothing to do, just return a target record as is
- RETURN existing_marc;
- ELSIF dyn_profile.preserve_rule <> '' THEN
- source_marc = existing_marc;
- target_marc = incoming_marc;
- replace_rule = dyn_profile.preserve_rule;
- ELSE
- source_marc = incoming_marc;
- target_marc = existing_marc;
- replace_rule = dyn_profile.replace_rule;
- END IF;
-
- RETURN vandelay.merge_record_xml( target_marc, source_marc, dyn_profile.add_rule, replace_rule, dyn_profile.strip_rule );
-
-END;
-$$ LANGUAGE PLPGSQL;
-
-COMMIT;
+++ /dev/null
-BEGIN;
-
--- SELECT evergreen.upgrade_deps_block_check('YYYY', :eg_version);
-
-INSERT into config.org_unit_setting_type
-( name, grp, label, description, datatype, fm_class ) VALUES
-(
- 'cat.default_merge_profile', 'cat',
- oils_i18n_gettext(
- 'cat.default_merge_profile',
- 'Default Merge Profile (Z39.50 and Record Buckets)',
- 'coust',
- 'label'
- ),
- oils_i18n_gettext(
- 'cat.default_merge_profile',
- 'Default merge profile to use during Z39.50 imports and record bucket merges',
- 'coust',
- 'description'
- ),
- 'link',
- 'vmp'
-);
-
-COMMIT;