From: Bill Erickson Date: Tue, 27 Dec 2011 17:19:05 +0000 (-0500) Subject: current_shelf_lib : DB and IDL X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=4af573a1dfbcfae4d78f07f1912cc11e3b78074a;p=evergreen%2Fequinox.git current_shelf_lib : DB and IDL Signed-off-by: Bill Erickson --- diff --git a/Open-ILS/examples/fm_IDL.xml b/Open-ILS/examples/fm_IDL.xml index 7e0b301081..42807fd398 100644 --- a/Open-ILS/examples/fm_IDL.xml +++ b/Open-ILS/examples/fm_IDL.xml @@ -4520,6 +4520,7 @@ SELECT usr, + @@ -4536,6 +4537,7 @@ SELECT usr, + @@ -4580,6 +4582,7 @@ SELECT usr, + @@ -4596,6 +4599,7 @@ SELECT usr, + diff --git a/Open-ILS/src/sql/Pg/090.schema.action.sql b/Open-ILS/src/sql/Pg/090.schema.action.sql index 05c45add4d..111b53da02 100644 --- a/Open-ILS/src/sql/Pg/090.schema.action.sql +++ b/Open-ILS/src/sql/Pg/090.schema.action.sql @@ -357,7 +357,8 @@ CREATE TABLE action.hold_request ( shelf_time TIMESTAMP WITH TIME ZONE, cut_in_line BOOL, mint_condition BOOL NOT NULL DEFAULT TRUE, - shelf_expire_time TIMESTAMPTZ + shelf_expire_time TIMESTAMPTZ, + current_shelf_lib INT REFERENCES actor.org_unit DEFERRABLE INITIALLY DEFERRED ); CREATE INDEX hold_request_target_idx ON action.hold_request (target); diff --git a/Open-ILS/src/sql/Pg/upgrade/XXXX.schema.hold-current-shelf-lib.sql b/Open-ILS/src/sql/Pg/upgrade/XXXX.schema.hold-current-shelf-lib.sql new file mode 100644 index 0000000000..cec449c7ca --- /dev/null +++ b/Open-ILS/src/sql/Pg/upgrade/XXXX.schema.hold-current-shelf-lib.sql @@ -0,0 +1,28 @@ +-- Evergreen DB patch XXXX.schema.hold-current-shelf-lib.sql +-- +-- FIXME: insert description of change, if needed +-- +BEGIN; + + +-- check whether patch can be applied +SELECT evergreen.upgrade_deps_block_check('XXXX', :eg_version); + +-- add the new column +ALTER TABLE action.hold_request ADD COLUMN current_shelf_lib + INT REFERENCES actor.org_unit DEFERRABLE INITIALLY DEFERRED; + +-- set the value for current_shelf_lib on existing shelved holds +UPDATE action.hold_request ahr + SET current_shelf_lib = pickup_lib + FROM asset.copy acp + WHERE + ahr.shelf_time IS NOT NULL + AND ahr.capture_time IS NOT NULL + AND ahr.current_copy IS NOT NULL + AND ahr.fulfillment_time IS NULL + AND ahr.cancel_time IS NULL + AND acp.id = ahr.current_copy + AND acp.status = 8; -- on holds shelf + +COMMIT;