From b6ecf9198f2abcd64d5d95aee741017a6e5028c3 Mon Sep 17 00:00:00 2001 From: miker Date: Tue, 24 Nov 2009 15:28:34 +0000 Subject: [PATCH] add explicit link from resource_type to biblio.record_entry git-svn-id: svn://svn.open-ils.org/ILS/trunk@15019 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- Open-ILS/examples/fm_IDL.xml | 2 ++ Open-ILS/src/sql/Pg/002.schema.config.sql | 2 +- Open-ILS/src/sql/Pg/095.schema.booking.sql | 4 +++- .../src/sql/Pg/upgrade/0090.schema.booking.bib-base-types.sql | 9 +++++++++ 4 files changed, 15 insertions(+), 2 deletions(-) create mode 100644 Open-ILS/src/sql/Pg/upgrade/0090.schema.booking.bib-base-types.sql diff --git a/Open-ILS/examples/fm_IDL.xml b/Open-ILS/examples/fm_IDL.xml index 161859e2b..5f35b32ac 100644 --- a/Open-ILS/examples/fm_IDL.xml +++ b/Open-ILS/examples/fm_IDL.xml @@ -2341,6 +2341,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + @@ -2348,6 +2349,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + diff --git a/Open-ILS/src/sql/Pg/002.schema.config.sql b/Open-ILS/src/sql/Pg/002.schema.config.sql index 0b06c6b12..4bce49f11 100644 --- a/Open-ILS/src/sql/Pg/002.schema.config.sql +++ b/Open-ILS/src/sql/Pg/002.schema.config.sql @@ -51,7 +51,7 @@ CREATE TABLE config.upgrade_log ( install_date TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW() ); -INSERT INTO config.upgrade_log (version) VALUES ('0089'); -- berick +INSERT INTO config.upgrade_log (version) VALUES ('0090'); -- miker CREATE TABLE config.bib_source ( id SERIAL PRIMARY KEY, diff --git a/Open-ILS/src/sql/Pg/095.schema.booking.sql b/Open-ILS/src/sql/Pg/095.schema.booking.sql index 6063ed31d..32840be29 100644 --- a/Open-ILS/src/sql/Pg/095.schema.booking.sql +++ b/Open-ILS/src/sql/Pg/095.schema.booking.sql @@ -30,7 +30,9 @@ CREATE TABLE booking.resource_type ( DEFERRABLE INITIALLY DEFERRED, catalog_item BOOLEAN NOT NULL DEFAULT FALSE, transferable BOOLEAN NOT NULL DEFAULT FALSE, - CONSTRAINT brt_name_once_per_owner UNIQUE(owner, name) + record INT REFERENCES biblio.record_entry (id) + DEFERRABLE INITIALLY DEFERRED, + CONSTRAINT brt_name_once_per_owner UNIQUE(owner, name, record) ); CREATE TABLE booking.resource ( diff --git a/Open-ILS/src/sql/Pg/upgrade/0090.schema.booking.bib-base-types.sql b/Open-ILS/src/sql/Pg/upgrade/0090.schema.booking.bib-base-types.sql new file mode 100644 index 000000000..2ee8bb740 --- /dev/null +++ b/Open-ILS/src/sql/Pg/upgrade/0090.schema.booking.bib-base-types.sql @@ -0,0 +1,9 @@ +BEGIN; + +INSERT INTO config.upgrade_log (version) VALUES ('0090'); -- miker + +ALTER TABLE booking.resource_type DROP CONSTRAINT brt_name_once_per_owner; +ALTER TABLE booking.resource_type ADD COLUMN record BIGINT REFERENCES biblio.record_entry (id) DEFERRABLE INITIALLY DEFERRED; +ALTER TABLE booking.resource_type ADD CONSTRAINT brt_name_or_record_once_per_owner UNIQUE(owner, name, record); + +COMMIT; -- 2.11.0