From 9121cfbb2a3aedad2321635aa87157351bfcef35 Mon Sep 17 00:00:00 2001 From: scottmk <scottmk@dcc99617-32d9-48b4-a31d-7c20da2025e4> Date: Mon, 8 Mar 2010 15:53:07 +0000 Subject: [PATCH] Add a cancel_reason column to acq.user_request, pointing to acq.cancel_reason. Also: corrected the IDL entries for similar columns elsewhere. The <link> should have a reltype of "might_have", not "has_a", since the column is nullable. M Open-ILS/src/sql/Pg/200.schema.acq.sql M Open-ILS/src/sql/Pg/002.schema.config.sql A Open-ILS/src/sql/Pg/upgrade/0181.schema.acq-user-request-cancel-cause.sql M Open-ILS/examples/fm_IDL.xml git-svn-id: svn://svn.open-ils.org/ILS/trunk@15733 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- Open-ILS/examples/fm_IDL.xml | 8 +++++--- Open-ILS/src/sql/Pg/002.schema.config.sql | 2 +- Open-ILS/src/sql/Pg/200.schema.acq.sql | 4 +++- .../sql/Pg/upgrade/0181.schema.acq-user-request-cancel-cause.sql | 9 +++++++++ 4 files changed, 18 insertions(+), 5 deletions(-) create mode 100644 Open-ILS/src/sql/Pg/upgrade/0181.schema.acq-user-request-cancel-cause.sql diff --git a/Open-ILS/examples/fm_IDL.xml b/Open-ILS/examples/fm_IDL.xml index 416181b0b6..6d4f6b86d4 100644 --- a/Open-ILS/examples/fm_IDL.xml +++ b/Open-ILS/examples/fm_IDL.xml @@ -4386,6 +4386,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA <field reporter:label="Mentioned In" name="mentioned" reporter:datatype="text" /> <field reporter:label="Other Info" name="other_info" reporter:datatype="text" /> <field reporter:label="Need Before Date" name="need_before" reporter:datatype="timestamp" /> + <field reporter:label="Cancel Reason" name="cancel_reason" reporter:datatype="link" /> </fields> <links> <link field="usr" reltype="has_a" key="id" map="" class="au"/> @@ -4393,6 +4394,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA <link field="lineitem" reltype="has_a" key="id" map="" class="jub"/> <link field="eg_bib" reltype="has_a" key="id" map="" class="bre"/> <link field="request_type" reltype="has_a" key="id" map="" class="aurt"/> + <link field="cancel_reason" reltype="might_have" key="id" map="" class="acqcr"/> </links> <permacrud xmlns="http://open-ils.org/spec/opensrf/IDL/permacrud/v1"> <actions> @@ -5136,7 +5138,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA <link field="lineitems" reltype="has_many" key="purchase_order" map="" class="jub"/> <link field="notes" reltype="has_many" key="purchase_order" map="" class="acqpon"/> <link field="ordering_agency" reltype="has_a" key="id" map="" class="aou"/> - <link field="cancel_reason" reltype="has_a" key="id" map="" class="acqcr"/> + <link field="cancel_reason" reltype="might_have" key="id" map="" class="acqcr"/> </links> <permacrud xmlns="http://open-ils.org/spec/opensrf/IDL/permacrud/v1"> <actions> @@ -5229,7 +5231,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA <link field="attributes" reltype="has_many" key="lineitem" map="" class="acqlia"/> <link field="lineitem_details" reltype="has_many" key="lineitem" map="" class="acqlid"/> <link field="lineitem_notes" reltype="has_many" key="lineitem" map="" class="acqlin"/> - <link field="cancel_reason" reltype="has_a" key="id" map="" class="acqcr"/> + <link field="cancel_reason" reltype="might_have" key="id" map="" class="acqcr"/> </links> <permacrud xmlns="http://open-ils.org/spec/opensrf/IDL/permacrud/v1"> <retrieve permission="CREATE_PURCHASE_ORDER VIEW_PURCHASE_ORDER CREATE_PICKLIST VIEW_PICKLIST"> @@ -5357,7 +5359,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA <link field="owning_lib" reltype="has_a" key="id" map="" class="aou"/> <link field="location" reltype="has_a" key="id" map="" class="acpl"/> <link field="circ_modifier" reltype="has_a" key="code" map="" class="ccm"/> - <link field="cancel_reason" reltype="has_a" key="id" map="" class="acqcr"/> + <link field="cancel_reason" reltype="might_have" key="id" map="" class="acqcr"/> </links> </class> diff --git a/Open-ILS/src/sql/Pg/002.schema.config.sql b/Open-ILS/src/sql/Pg/002.schema.config.sql index d9f3dbb28e..76f60b9e1b 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 ('0180'); -- Scott McKellar +INSERT INTO config.upgrade_log (version) VALUES ('0181'); -- Scott McKellar CREATE TABLE config.bib_source ( id SERIAL PRIMARY KEY, diff --git a/Open-ILS/src/sql/Pg/200.schema.acq.sql b/Open-ILS/src/sql/Pg/200.schema.acq.sql index bc99f0e84e..35abc2db15 100644 --- a/Open-ILS/src/sql/Pg/200.schema.acq.sql +++ b/Open-ILS/src/sql/Pg/200.schema.acq.sql @@ -831,7 +831,9 @@ CREATE TABLE acq.user_request ( location TEXT, pubdate TEXT, mentioned TEXT, - other_info TEXT + other_info TEXT, + cancel_reason INT REFERENCES acq.cancel_reason( id ) + DEFERRABLE INITIALLY DEFERRED ); diff --git a/Open-ILS/src/sql/Pg/upgrade/0181.schema.acq-user-request-cancel-cause.sql b/Open-ILS/src/sql/Pg/upgrade/0181.schema.acq-user-request-cancel-cause.sql new file mode 100644 index 0000000000..2a28d79498 --- /dev/null +++ b/Open-ILS/src/sql/Pg/upgrade/0181.schema.acq-user-request-cancel-cause.sql @@ -0,0 +1,9 @@ +BEGIN; + +INSERT INTO config.upgrade_log (version) VALUES ('0181'); -- Scott McKellar + +ALTER TABLE acq.user_request + ADD COLUMN cancel_reason INT + REFERENCES acq.cancel_reason( id ) DEFERRABLE INITIALLY DEFERRED; + +COMMIT; -- 2.11.0