From c251e0d25b8408ea0bdcc532b6c74ff3021faf98 Mon Sep 17 00:00:00 2001 From: miker Date: Thu, 17 Dec 2009 21:49:05 +0000 Subject: [PATCH] add tracking table for booking reservations transits (similar to hold transits) git-svn-id: svn://svn.open-ils.org/ILS/trunk@15188 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- Open-ILS/examples/fm_IDL.xml | 35 ++++++++++++++++++++++ .../OpenILS/Application/Storage/CDBI/action.pm | 10 +++++++ .../OpenILS/Application/Storage/Driver/Pg/dbi.pm | 7 +++++ Open-ILS/src/sql/Pg/002.schema.config.sql | 2 +- Open-ILS/src/sql/Pg/095.schema.booking.sql | 9 ++++++ .../sql/Pg/upgrade/119.schema.booking.transits.sql | 15 ++++++++++ 6 files changed, 77 insertions(+), 1 deletion(-) create mode 100644 Open-ILS/src/sql/Pg/upgrade/119.schema.booking.transits.sql diff --git a/Open-ILS/examples/fm_IDL.xml b/Open-ILS/examples/fm_IDL.xml index 2196918364..3a104da632 100644 --- a/Open-ILS/examples/fm_IDL.xml +++ b/Open-ILS/examples/fm_IDL.xml @@ -4065,6 +4065,41 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Open-ILS/src/perlmods/OpenILS/Application/Storage/CDBI/action.pm b/Open-ILS/src/perlmods/OpenILS/Application/Storage/CDBI/action.pm index 8802e5781b..8346ea4658 100644 --- a/Open-ILS/src/perlmods/OpenILS/Application/Storage/CDBI/action.pm +++ b/Open-ILS/src/perlmods/OpenILS/Application/Storage/CDBI/action.pm @@ -127,6 +127,16 @@ __PACKAGE__->columns(Essential => qw/source dest persistant_transfer target_copy #------------------------------------------------------------------------------- +package action::reservation_transit_copy; +use base qw/action/; +__PACKAGE__->table('action_reservation_transit_copy'); +__PACKAGE__->columns(Primary => 'id'); +__PACKAGE__->columns(Essential => qw/source dest persistant_transfer target_copy + source_send_time dest_recv_time prev_hop prev_dest + copy_status reservation/); + +#------------------------------------------------------------------------------- + package action::transit_copy; use base qw/action/; __PACKAGE__->table('action_transit_copy'); diff --git a/Open-ILS/src/perlmods/OpenILS/Application/Storage/Driver/Pg/dbi.pm b/Open-ILS/src/perlmods/OpenILS/Application/Storage/Driver/Pg/dbi.pm index a3fd66e103..b44a836321 100644 --- a/Open-ILS/src/perlmods/OpenILS/Application/Storage/Driver/Pg/dbi.pm +++ b/Open-ILS/src/perlmods/OpenILS/Application/Storage/Driver/Pg/dbi.pm @@ -689,6 +689,13 @@ #------------------------------------------------------------------------------- + package action::reservation_transit_copy; + + action::reservation_transit_copy->sequence( 'action.transit_copy_id_seq' ); + action::reservation_transit_copy->table('action.reservation_transit_copy'); + + #------------------------------------------------------------------------------- + package action::transit_copy; action::transit_copy->sequence( 'action.transit_copy_id_seq' ); diff --git a/Open-ILS/src/sql/Pg/002.schema.config.sql b/Open-ILS/src/sql/Pg/002.schema.config.sql index 46fe211aa3..ec33e7dd2c 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 ('0118'); -- berick +INSERT INTO config.upgrade_log (version) VALUES ('0119'); -- 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 3a878a8142..94ce38e03a 100644 --- a/Open-ILS/src/sql/Pg/095.schema.booking.sql +++ b/Open-ILS/src/sql/Pg/095.schema.booking.sql @@ -156,4 +156,13 @@ CREATE TABLE booking.reservation_attr_value_map ( CONSTRAINT bravm_logical_key UNIQUE(reservation, attr_value) ); +CREATE TABLE action.reservation_transit_copy ( + reservation INT REFERENCES booking.reservation (id) ON DELETE SET NULL DEFERRABLE INITIALLY DEFERRED +) INHERITS (action.transit_copy); +ALTER TABLE action.reservation_transit_copy ADD PRIMARY KEY (id); +ALTER TABLE action.reservation_transit_copy ADD CONSTRAINT artc_tc_fkey FOREIGN KEY (target_copy) REFERENCES booking.resource (id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; +CREATE INDEX active_reservation_transit_dest_idx ON "action".reservation_transit_copy (dest); +CREATE INDEX active_reservation_transit_source_idx ON "action".reservation_transit_copy (source); +CREATE INDEX active_reservation_transit_cp_idx ON "action".reservation_transit_copy (target_copy); + COMMIT; diff --git a/Open-ILS/src/sql/Pg/upgrade/119.schema.booking.transits.sql b/Open-ILS/src/sql/Pg/upgrade/119.schema.booking.transits.sql new file mode 100644 index 0000000000..c3a1814393 --- /dev/null +++ b/Open-ILS/src/sql/Pg/upgrade/119.schema.booking.transits.sql @@ -0,0 +1,15 @@ +BEGIN; + +INSERT INTO config.upgrade_log (version) VALUES ('0119'); -- miker + +CREATE TABLE action.reservation_transit_copy ( + reservation INT REFERENCES booking.reservation (id) ON DELETE SET NULL DEFERRABLE INITIALLY DEFERRED +) INHERITS (action.transit_copy); +ALTER TABLE action.reservation_transit_copy ADD PRIMARY KEY (id); +ALTER TABLE action.reservation_transit_copy ADD CONSTRAINT artc_tc_fkey FOREIGN KEY (target_copy) REFERENCES booking.resource (id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; +CREATE INDEX active_reservation_transit_dest_idx ON "action".reservation_transit_copy (dest); +CREATE INDEX active_reservation_transit_source_idx ON "action".reservation_transit_copy (source); +CREATE INDEX active_reservation_transit_cp_idx ON "action".reservation_transit_copy (target_copy); + +COMMIT; + -- 2.11.0