From 25da7a1e2f45577dfab05db057baea4a79d7855c Mon Sep 17 00:00:00 2001 From: Mike Rylander Date: Fri, 18 Feb 2011 08:49:18 -0500 Subject: [PATCH] allow multiple parts per copy primarily for part per record per copy --- Open-ILS/examples/fm_IDL.xml | 3 ++- Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/CDBI/asset.pm | 4 ++-- Open-ILS/src/sql/Pg/040.schema.asset.sql | 4 +++- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/Open-ILS/examples/fm_IDL.xml b/Open-ILS/examples/fm_IDL.xml index 7f659bbc15..965db28e0a 100644 --- a/Open-ILS/examples/fm_IDL.xml +++ b/Open-ILS/examples/fm_IDL.xml @@ -1955,7 +1955,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA - + + diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/CDBI/asset.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/CDBI/asset.pm index e69e1019d5..3df4d40483 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/CDBI/asset.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/CDBI/asset.pm @@ -63,8 +63,8 @@ package asset::copy_part_map; use base qw/asset/; __PACKAGE__->table( 'asset_copy_part_map' ); -__PACKAGE__->columns( Primary => qw/target_copy/ ); -__PACKAGE__->columns( Essential => qw/part/); +__PACKAGE__->columns( Primary => qw/id/ ); +__PACKAGE__->columns( Essential => qw/target_copy part/); #------------------------------------------------------------------------------- package asset::stat_cat; diff --git a/Open-ILS/src/sql/Pg/040.schema.asset.sql b/Open-ILS/src/sql/Pg/040.schema.asset.sql index d203ef720a..64bf2a2292 100644 --- a/Open-ILS/src/sql/Pg/040.schema.asset.sql +++ b/Open-ILS/src/sql/Pg/040.schema.asset.sql @@ -92,9 +92,11 @@ CREATE INDEX cp_create_date ON asset.copy (create_date); CREATE RULE protect_copy_delete AS ON DELETE TO asset.copy DO INSTEAD UPDATE asset.copy SET deleted = TRUE WHERE OLD.id = asset.copy.id; CREATE TABLE asset.copy_part_map ( - target_copy BIGINT PRIMARY KEY, -- points o asset.copy + id SERIAL PRIMARY KEY, + target_copy BIGINT NOT NULL, -- points o asset.copy part INT NOT NULL REFERENCES biblio.monograph_part (id) ON DELETE CASCADE ); +CREATE UNIQUE INDEX copy_part_map_cp_part_idx ON asset.copy_part_map (target_copy, part); CREATE TABLE asset.opac_visible_copies ( id BIGINT primary key, -- copy id -- 2.11.0