Signed-off-by: Bill Erickson <berickxx@gmail.com>
--- /dev/null
+-- Deploy kcls-evergreen:test-data-mangle to pg
+-- requires: KMAIN-1765-reingest-causing-false-browse-headings
+
+BEGIN;
+
+-- Teturns true if at least one org unit is in the DB
+-- This is our indication that deployment scripts should
+-- mangle (insert,update,delete) data.
+CREATE OR REPLACE FUNCTION
+ evergreen.mangle_data_on_deploy() RETURNS BOOLEAN AS $$
+ SELECT EXISTS(SELECT id FROM actor.org_unit LIMIT 1);
+$$ LANGUAGE SQL;
+
+COMMIT;
--- /dev/null
+-- Revert kcls-evergreen:test-data-mangle from pg
+
+BEGIN;
+
+DROP FUNCTION evergreen.mangle_data_on_deploy();
+
+COMMIT;
02.collection-hq-items-2.5 [01.2.4.1-2.5.7-upgrade] 2015-08-12T21:42:53Z Joshua (JD) Drake <jd@commandprompt.com> # added
KMAIN-1765-reingest-causing-false-browse-headings [02.collection-hq-items-2.5] 2015-08-12T21:45:43Z Joshua (JD) Drake <jd@commandprompt.com> # added
+test-data-mangle [KMAIN-1765-reingest-causing-false-browse-headings] 2015-08-14T20:36:56Z Bill Erickson <berickxx@gmail.com > # Check for wether to mangle data on deploy
--- /dev/null
+-- Verify kcls-evergreen:test-data-mangle on pg
+
+BEGIN;
+
+SELECT has_function_privilege('evergreen.mangle_data_on_deploy()', 'execute');
+
+ROLLBACK;