From c9dae1827b4e6d01fa78b10343a9530aeca3f824 Mon Sep 17 00:00:00 2001 From: Bill Erickson Date: Wed, 15 Feb 2012 12:22:47 -0500 Subject: [PATCH] Copy Location Search Groups : DB / IDL Adds 2 new tables, one for defining copy location groups and another for mapping copy locations to groups. Signed-off-by: Bill Erickson Signed-off-by: Dan Scott --- Open-ILS/examples/fm_IDL.xml | 47 ++++++++++++++++++++++ Open-ILS/src/sql/Pg/040.schema.asset.sql | 17 ++++++++ .../upgrade/XXXX.schema.copy_loc_search_groups.sql | 29 +++++++++++++ 3 files changed, 93 insertions(+) create mode 100644 Open-ILS/src/sql/Pg/upgrade/XXXX.schema.copy_loc_search_groups.sql diff --git a/Open-ILS/examples/fm_IDL.xml b/Open-ILS/examples/fm_IDL.xml index 2924bfca5c..c7bb14d5da 100644 --- a/Open-ILS/examples/fm_IDL.xml +++ b/Open-ILS/examples/fm_IDL.xml @@ -3928,6 +3928,53 @@ SELECT usr, + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Open-ILS/src/sql/Pg/040.schema.asset.sql b/Open-ILS/src/sql/Pg/040.schema.asset.sql index 92fd81c5a8..85d58f637d 100644 --- a/Open-ILS/src/sql/Pg/040.schema.asset.sql +++ b/Open-ILS/src/sql/Pg/040.schema.asset.sql @@ -50,6 +50,23 @@ CREATE TABLE asset.copy_location_order CONSTRAINT acplo_once_per_org UNIQUE ( location, org ) ); +CREATE TABLE asset.copy_location_group ( + id SERIAL PRIMARY KEY, + name TEXT NOT NULL, -- i18n + owner INT NOT NULL REFERENCES actor.org_unit (id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED, + pos INT NOT NULL DEFAULT 0, + opac_visible BOOL NOT NULL DEFAULT TRUE, + CONSTRAINT lgroup_once_per_owner UNIQUE (owner,name) +); + +CREATE TABLE asset.copy_location_group_map ( + id SERIAL PRIMARY KEY, + location INT NOT NULL REFERENCES asset.copy_location (id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED, + lgroup INT NOT NULL REFERENCES asset.copy_location_group (id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED, + CONSTRAINT lgroup_once_per_group UNIQUE (lgroup,location) +); + + CREATE TABLE asset.copy ( id BIGSERIAL PRIMARY KEY, circ_lib INT NOT NULL REFERENCES actor.org_unit (id) DEFERRABLE INITIALLY DEFERRED, diff --git a/Open-ILS/src/sql/Pg/upgrade/XXXX.schema.copy_loc_search_groups.sql b/Open-ILS/src/sql/Pg/upgrade/XXXX.schema.copy_loc_search_groups.sql new file mode 100644 index 0000000000..a6dd74a3b6 --- /dev/null +++ b/Open-ILS/src/sql/Pg/upgrade/XXXX.schema.copy_loc_search_groups.sql @@ -0,0 +1,29 @@ +BEGIN; + +-- SELECT evergreen.upgrade_deps_block_check('XXXX', :eg_version); + +CREATE TABLE asset.copy_location_group ( + id SERIAL PRIMARY KEY, + name TEXT NOT NULL, -- i18n + owner INT NOT NULL REFERENCES actor.org_unit (id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED, + pos INT NOT NULL DEFAULT 0, + opac_visible BOOL NOT NULL DEFAULT TRUE, + CONSTRAINT lgroup_once_per_owner UNIQUE (owner,name) +); + +CREATE TABLE asset.copy_location_group_map ( + id SERIAL PRIMARY KEY, + location INT NOT NULL REFERENCES asset.copy_location (id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED, + lgroup INT NOT NULL REFERENCES asset.copy_location_group (id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED, + CONSTRAINT lgroup_once_per_group UNIQUE (lgroup,location) +); + +COMMIT; + +/* UNDO +BEGIN; +DROP TABLE asset.copy_location_group_map; +DROP TABLE asset.copy_location_group; +COMMIT; +*/ + -- 2.11.0