CONSTRAINT cm_once_per_set UNIQUE (limit_set, circ_mod)
);
+-- Linkage between limit sets and copy locations
+CREATE TABLE config.circ_limit_set_copy_loc_map (
+ id SERIAL PRIMARY KEY,
+ limit_set INT NOT NULL REFERENCES config.circ_limit_set (id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED,
+ copy_loc INT NOT NULL REFERENCES asset.copy_location (id) ON DELETE CASCADE ON UPDATE CASCADE DEFERRABLE INITIALLY DEFERRED,
+ CONSTRAINT cl_once_per_set UNIQUE (limit_set, copy_loc)
+);
+
-- Linkage between limit sets and limit groups
CREATE TABLE config.circ_limit_set_group_map (
id SERIAL PRIMARY KEY,
-- Linkage between limit sets and circ mods
---CREATE TABLE config.circ_limit_set_copy_loc_map (
- --id SERIAL PRIMARY KEY,
- --limit_set INT NOT NULL REFERENCES config.circ_limit_set (id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED,
- --copy_loc INT NOT NULL REFERENCES asset.copy_location (id) ON DELETE CASCADE ON UPDATE CASCADE DEFERRABLE INITIALLY DEFERRED,
- --CONSTRAINT cl_once_per_set UNIQUE (limit_set, copy_loc)
---);
-
+CREATE TABLE config.circ_limit_set_copy_loc_map (
+ id SERIAL PRIMARY KEY,
+ limit_set INT NOT NULL REFERENCES config.circ_limit_set (id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED,
+ copy_loc INT NOT NULL REFERENCES asset.copy_location (id) ON DELETE CASCADE ON UPDATE CASCADE DEFERRABLE INITIALLY DEFERRED,
+ CONSTRAINT cl_once_per_set UNIQUE (limit_set, copy_loc)
+);
+
+-- Add support for checking config.circ_limit_set_copy_loc_map's
CREATE OR REPLACE FUNCTION action.item_user_circ_test( circ_ou INT, match_item BIGINT, match_user INT, renewal BOOL )
RETURNS SETOF action.circ_matrix_test_result AS $func$
DECLARE
END;
$func$ LANGUAGE plpgsql;
-
-/*
--- UNDO
-DROP TABLE IF EXISTS config.circ_limit_set_copy_loc_map;
-*/
-