Add a cancel_reason column to acq.user_request, pointing to acq.cancel_reason.
authorscottmk <scottmk@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Mon, 8 Mar 2010 15:53:07 +0000 (15:53 +0000)
committerscottmk <scottmk@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Mon, 8 Mar 2010 15:53:07 +0000 (15:53 +0000)
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
Open-ILS/src/sql/Pg/002.schema.config.sql
Open-ILS/src/sql/Pg/200.schema.acq.sql
Open-ILS/src/sql/Pg/upgrade/0181.schema.acq-user-request-cancel-cause.sql [new file with mode: 0644]

index 416181b..6d4f6b8 100644 (file)
@@ -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>
 
index d9f3dbb..76f60b9 100644 (file)
@@ -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,
index bc99f0e..35abc2d 100644 (file)
@@ -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 (file)
index 0000000..2a28d79
--- /dev/null
@@ -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;