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 ('1113', :eg_version); -- Dyrcona/csharp/miker
+INSERT INTO config.upgrade_log (version, applied_to) VALUES ('1114', :eg_version); -- JBoyer/miker
CREATE TABLE config.bib_source (
id SERIAL PRIMARY KEY,
--- /dev/null
+BEGIN;
+
+SELECT evergreen.upgrade_deps_block_check('1114', :eg_version);
+
+CREATE OR REPLACE FUNCTION asset.copy_state (cid BIGINT) RETURNS TEXT AS $$
+DECLARE
+ last_circ_stop TEXT;
+ the_copy asset.copy%ROWTYPE;
+BEGIN
+
+ SELECT * INTO the_copy FROM asset.copy WHERE id = cid;
+ IF NOT FOUND THEN RETURN NULL; END IF;
+
+ IF the_copy.status = 3 THEN -- Lost
+ RETURN 'LOST';
+ ELSIF the_copy.status = 4 THEN -- Missing
+ RETURN 'MISSING';
+ ELSIF the_copy.status = 14 THEN -- Damaged
+ RETURN 'DAMAGED';
+ ELSIF the_copy.status = 17 THEN -- Lost and paid
+ RETURN 'LOST_AND_PAID';
+ END IF;
+
+ SELECT stop_fines INTO last_circ_stop
+ FROM action.circulation
+ WHERE target_copy = cid AND checkin_time IS NULL
+ ORDER BY xact_start DESC LIMIT 1;
+
+ IF FOUND THEN
+ IF last_circ_stop IN (
+ 'CLAIMSNEVERCHECKEDOUT',
+ 'CLAIMSRETURNED',
+ 'LONGOVERDUE'
+ ) THEN
+ RETURN last_circ_stop;
+ END IF;
+ END IF;
+
+ RETURN 'NORMAL';
+END;
+$$ LANGUAGE PLPGSQL;
+
+COMMIT;
+
+++ /dev/null
-BEGIN;
-
-SELECT evergreen.upgrade_deps_block_check('XXXX', :eg_version);
-
-CREATE OR REPLACE FUNCTION asset.copy_state (cid BIGINT) RETURNS TEXT AS $$
-DECLARE
- last_circ_stop TEXT;
- the_copy asset.copy%ROWTYPE;
-BEGIN
-
- SELECT * INTO the_copy FROM asset.copy WHERE id = cid;
- IF NOT FOUND THEN RETURN NULL; END IF;
-
- IF the_copy.status = 3 THEN -- Lost
- RETURN 'LOST';
- ELSIF the_copy.status = 4 THEN -- Missing
- RETURN 'MISSING';
- ELSIF the_copy.status = 14 THEN -- Damaged
- RETURN 'DAMAGED';
- ELSIF the_copy.status = 17 THEN -- Lost and paid
- RETURN 'LOST_AND_PAID';
- END IF;
-
- SELECT stop_fines INTO last_circ_stop
- FROM action.circulation
- WHERE target_copy = cid AND checkin_time IS NULL
- ORDER BY xact_start DESC LIMIT 1;
-
- IF FOUND THEN
- IF last_circ_stop IN (
- 'CLAIMSNEVERCHECKEDOUT',
- 'CLAIMSRETURNED',
- 'LONGOVERDUE'
- ) THEN
- RETURN last_circ_stop;
- END IF;
- END IF;
-
- RETURN 'NORMAL';
-END;
-$$ LANGUAGE PLPGSQL;
-
-COMMIT;
-