Merge Dan Wells' changes to the serial schema from the
authorscottmk <scottmk@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Tue, 27 Jul 2010 17:27:01 +0000 (17:27 +0000)
committerscottmk <scottmk@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Tue, 27 Jul 2010 17:27:01 +0000 (17:27 +0000)
seials-integration branch.

M    Open-ILS/src/sql/Pg/002.schema.config.sql
A    Open-ILS/src/sql/Pg/upgrade/0352.schema.serials-integration.sql
M    Open-ILS/src/sql/Pg/210.schema.serials.sql
M    Open-ILS/examples/fm_IDL.xml

git-svn-id: svn://svn.open-ils.org/ILS/trunk@17039 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/210.schema.serials.sql
Open-ILS/src/sql/Pg/upgrade/0352.schema.serials-integration.sql [new file with mode: 0644]

index 00d2ca5..6b64b3f 100644 (file)
@@ -3007,19 +3007,20 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
                        <field name="incomplete" oils_persist:virtual="true" />
                </fields>
        </class>
+
        <class id="sre" controller="open-ils.pcrud open-ils.cstore" oils_obj:fieldmapper="serial::record_entry" oils_persist:tablename="serial.record_entry" reporter:label="Serial Record Entry">
                <fields oils_persist:primary="id" oils_persist:sequence="serial.record_entry_id_seq">
                        <field reporter:label="Is Active" name="active" reporter:datatype="bool"/>
                        <field reporter:label="Bib Record" name="record" reporter:datatype="link"/>
                        <field reporter:label="Create Date" name="create_date" reporter:datatype="timestamp"/>
-                       <field reporter:label="Creator" name="creator" />
+                       <field reporter:label="Creator" name="creator" reporter:datatype="link"/>
                        <field reporter:label="Is Deleted" name="deleted" reporter:datatype="bool"/>
                        <field reporter:label="Edit date" name="edit_date" reporter:datatype="timestamp"/>
-                       <field reporter:label="Editor" name="editor" />
+                       <field reporter:label="Editor" name="editor" reporter:datatype="link"/>
                        <field reporter:label="ID" name="id" reporter:datatype="id" />
-                       <field reporter:label="Last Transaction ID" name="last_xact_id" />
-                       <field reporter:label="MARC" name="marc" />
-                       <field reporter:label="Source" name="source" />
+                       <field reporter:label="Last Transaction ID" name="last_xact_id" reporter:datatype="text"/>
+                       <field reporter:label="MARC" name="marc" reporter:datatype="text"/>
+                       <field reporter:label="Source" name="source" reporter:datatype="int"/>
                        <field reporter:label="Owning Org Unit" name="owning_lib" reporter:datatype="org_unit"/>
                </fields>
                <links>
@@ -3038,12 +3039,12 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
                </permacrud>
        </class>
 
-       <class id="sercap" controller="open-ils.cstore open-ils.pcrud" oils_obj:fieldmapper="serial::caption_and_pattern" oils_persist:tablename="serial.caption_and_pattern" reporter:label="Caption and Pattern">
+       <class id="scap" controller="open-ils.cstore open-ils.pcrud" oils_obj:fieldmapper="serial::caption_and_pattern" oils_persist:tablename="serial.caption_and_pattern" reporter:label="Caption and Pattern">
                <fields oils_persist:primary="id" oils_persist:sequence="serial.caption_and_pattern_id_seq">
                        <field reporter:label="ID" name="id" reporter:datatype="id"/>
                        <field reporter:label="Subscription" name="subscription" reporter:datatype="link"/>
                        <field reporter:label="Type" name="type" reporter:datatype="text"/>
-                       <field reporter:label="Create Time" name="create_time" reporter:datatype="timestamp"/>
+                       <field reporter:label="Create Date" name="create_date" reporter:datatype="timestamp"/>
                        <field reporter:label="Active?" name="active" reporter:datatype="bool"/>
                        <field reporter:label="Pattern Code" name="pattern_code" reporter:datatype="text"/>
                        <field reporter:label="Enum 1" name="enum_1" reporter:datatype="text"/>
@@ -3059,7 +3060,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
                        <field reporter:label="Chron 5" name="chron_5" reporter:datatype="text"/>
                </fields>
                <links>
-                       <link field="record" reltype="has_a" key="id" map="" class="ssub"/>
+                       <link field="subscription" reltype="has_a" key="id" map="" class="ssub"/>
                </links>
                <permacrud xmlns="http://open-ils.org/spec/opensrf/IDL/permacrud/v1">
                </permacrud>
@@ -3073,17 +3074,37 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
                        <field reporter:label="End Date" name="end_date" reporter:datatype="timestamp"/>
                        <field reporter:label="Bibliographic Record Entry" name="record_entry" reporter:datatype="link"/>
                        <field reporter:label="Expected Date Offset" name="expected_date_offset" reporter:datatype="interval"/>
-                       <field reporter:label="Captions and Patterns" name="captions_and_patterns" oils_persist:virtual="true" reporter:datatype="link"/>
                        <field reporter:label="Distributions" name="distributions" oils_persist:virtual="true" reporter:datatype="link"/>
                        <field reporter:label="Issuances" name="issuances" oils_persist:virtual="true" reporter:datatype="link"/>
+                       <field reporter:label="Captions and Patterns" name="scaps" oils_persist:virtual="true" reporter:datatype="link"/>
+                       <field reporter:label="Notes" name="notes" oils_persist:virtual="true" reporter:datatype="link"/>
                </fields>
                <links>
                        <link field="owning_lib" reltype="has_a" key="id" map="" class="aou"/>
                        <link field="record_entry" reltype="has_a" key="id" map="" class="bre"/>
-                       <link field="captions_and_patterns" reltype="has_many" key="id" map="" class="sercap"/>
-                       <link field="distributions" reltype="has_many" key="id" map="" class="sdist"/>
-                       <link field="issuances" reltype="has_many" key="id" map="" class="siss"/>
+                       <link field="distributions" reltype="has_many" key="subscription" map="" class="sdist"/>
+                       <link field="issuances" reltype="has_many" key="subscription" map="" class="siss"/>
+                       <link field="scaps" reltype="has_many" key="subscription" map="" class="scap"/>
+                       <link field="notes" reltype="has_many" key="subscription" map="" class="ssubn"/>
+               </links>
+       </class>
+
+       <class id="ssubn" controller="open-ils.cstore open-ils.pcrud" oils_obj:fieldmapper="serial::subscription_note" oils_persist:tablename="serial.subscription_note" reporter:label="Subscription Note">
+               <fields oils_persist:primary="id" oils_persist:sequence="serial.subscription_note_id_seq">
+                       <field reporter:label="ID" name="id" reporter:datatype="id"/>
+                       <field reporter:label="Subscription" name="subscription" reporter:datatype="link"/>
+                       <field reporter:label="Creator" name="creator" reporter:datatype="link"/>
+                       <field reporter:label="Create Date" name="create_date" reporter:datatype="timestamp"/>
+                       <field reporter:label="Public?" name="pub" reporter:datatype="bool"/>
+                       <field reporter:label="Title" name="title" reporter:datatype="text"/>
+                       <field reporter:label="Value" name="value" reporter:datatype="text"/>
+               </fields>
+               <links>
+                       <link field="subscription" reltype="has_a" key="id" map="" class="ssub"/>
+                       <link field="creator" reltype="has_a" key="id" map="" class="au"/>
                </links>
+               <permacrud xmlns="http://open-ils.org/spec/opensrf/IDL/permacrud/v1">
+               </permacrud>
        </class>
 
        <class id="sdist" controller="open-ils.cstore open-ils.pcrud" oils_obj:fieldmapper="serial::distribution" oils_persist:tablename="serial.distribution" reporter:label="Distribution">
@@ -3097,12 +3118,13 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
                        <field reporter:label="Receive Unit Template" name="receive_unit_template" reporter:datatype="link"/>
                        <field reporter:label="Bind Call Number" name="bind_call_number" reporter:datatype="link"/>
                        <field reporter:label="Bind Unit Template" name="bind_unit_template" reporter:datatype="link"/>
-                       <field reporter:label="Unit Label Base" name="unit_label_base" reporter:datatype="text"/>
+                       <field reporter:label="Unit Label Prefix" name="unit_label_prefix" reporter:datatype="text"/>
                        <field reporter:label="Unit Label Suffix" name="unit_label_suffix" reporter:datatype="text"/>
-                       <field reporter:label="Bib Summaries" name="bib_summaries" oils_persist:virtual="true" reporter:datatype="link"/>
-                       <field reporter:label="Suplemental Summaries" name="sup_summaries" oils_persist:virtual="true" reporter:datatype="link"/>
-                       <field reporter:label="Index Summaries" name="index_summaries" oils_persist:virtual="true" reporter:datatype="link"/>
                        <field reporter:label="Streams" name="streams" oils_persist:virtual="true" reporter:datatype="link"/>
+                       <field reporter:label="Notes" name="notes" oils_persist:virtual="true" reporter:datatype="link"/>
+                       <field reporter:label="Basic Issue Summary" name="basic_summary" oils_persist:virtual="true" reporter:datatype="link"/>
+                       <field reporter:label="Supplemental Issue Summary" name="supplement_summary" oils_persist:virtual="true" reporter:datatype="link"/>
+                       <field reporter:label="Index Issue Summary" name="index_summary" oils_persist:virtual="true" reporter:datatype="link"/>
                </fields>
                <links>
                        <link field="record_entry" reltype="has_a" key="id" map="" class="sre"/>
@@ -3112,12 +3134,43 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
                        <link field="receive_unit_template" reltype="has_a" key="id" map="" class="act"/>
                        <link field="bind_call_number" reltype="has_a" key="id" map="" class="acn"/>
                        <link field="bind_unit_template" reltype="has_a" key="id" map="" class="act"/>
-                       <link field="bib_summaries" reltype="has_many" key="id" map="" class="sbsum"/>
-                       <link field="sup_summaries" reltype="has_many" key="id" map="" class="sssum"/>
-                       <link field="index_summaries" reltype="has_many" key="id" map="" class="sisum"/>
-                       <link field="streams" reltype="has_many" key="id" map="" class="sstr"/>
+                       <link field="streams" reltype="has_many" key="distribution" map="" class="sstr"/>
+                       <link field="notes" reltype="has_many" key="distribution" map="" class="sdistn"/>
+                       <link field="basic_summary" reltype="might_have" key="distribution" map="" class="sbsum"/>
+                       <link field="supplement_summary" reltype="might_have" key="distribution" map="" class="sssum"/>
+                       <link field="index_summary" reltype="might_have" key="distribution" map="" class="sisum"/>
+               </links>
+               <permacrud xmlns="http://open-ils.org/spec/opensrf/IDL/permacrud/v1">
+                       <actions>
+                               <create/>
+                               <retrieve/>
+                               <update/>
+                               <delete/>
+                       </actions>
+               </permacrud>
+       </class>
+
+       <class id="sdistn" controller="open-ils.cstore open-ils.pcrud" oils_obj:fieldmapper="serial::distribution_note" oils_persist:tablename="serial.distribution_note" reporter:label="Distribution Note">
+               <fields oils_persist:primary="id" oils_persist:sequence="serial.distribution_note_id_seq">
+                       <field reporter:label="ID" name="id" reporter:datatype="id"/>
+                       <field reporter:label="Distribution" name="distribution" reporter:datatype="link"/>
+                       <field reporter:label="Creator" name="creator" reporter:datatype="link"/>
+                       <field reporter:label="Create Date" name="create_date" reporter:datatype="timestamp"/>
+                       <field reporter:label="Public?" name="pub" reporter:datatype="bool"/>
+                       <field reporter:label="Title" name="title" reporter:datatype="text"/>
+                       <field reporter:label="Value" name="value" reporter:datatype="text"/>
+               </fields>
+               <links>
+                       <link field="distribution" reltype="has_a" key="id" map="" class="sdist"/>
+                       <link field="creator" reltype="has_a" key="id" map="" class="au"/>
                </links>
                <permacrud xmlns="http://open-ils.org/spec/opensrf/IDL/permacrud/v1">
+                       <actions>
+                               <create/>
+                               <retrieve/>
+                               <update/>
+                               <delete/>
+                       </actions>
                </permacrud>
        </class>
 
@@ -3126,11 +3179,9 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
                        <field reporter:label="ID" name="id" reporter:datatype="id"/>
                        <field reporter:label="Distribution" name="distribution" reporter:datatype="link"/>
                        <field reporter:label="Routing Label" name="routing_label" reporter:datatype="text"/>
-                       <field reporter:label="Items" name="items" oils_persist:virtual="true" reporter:datatype="link"/>
                </fields>
                <links>
                        <link field="distribution" reltype="has_a" key="id" map="" class="sdist"/>
-                       <link field="items" reltype="has_many" key="id" map="" class="sitem"/>
                </links>
                <permacrud xmlns="http://open-ils.org/spec/opensrf/IDL/permacrud/v1">
                </permacrud>
@@ -3153,7 +3204,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
                </permacrud>
        </class>
 
-       <class id="siss" controller="open-ils.cstore" oils_obj:fieldmapper="serial::issuance" oils_persist:tablename="serial.issuance" reporter:label="Issuance">
+       <class id="siss" controller="open-ils.cstore open-ils.pcrud" oils_obj:fieldmapper="serial::issuance" oils_persist:tablename="serial.issuance" reporter:label="Issuance">
                <fields oils_persist:primary="id" oils_persist:sequence="serial.issuance_id_seq">
                        <field reporter:label="ID" name="id" reporter:datatype="id" />
                        <field reporter:label="Creator" name="creator" reporter:datatype="link"/>
@@ -3161,83 +3212,95 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
                        <field reporter:label="Create Date" name="create_date" reporter:datatype="timestamp"/>
                        <field reporter:label="Edit Date" name="edit_date" reporter:datatype="timestamp"/>
                        <field reporter:label="Subscription" name="subscription" reporter:datatype="link"/>
+                       <field reporter:label="Caption/Pattern" name="caption_and_pattern" reporter:datatype="link"/>
                        <field reporter:label="Label" name="label" reporter:datatype="text"/>
                        <field reporter:label="Date Published" name="date_published" reporter:datatype="timestamp"/>
                        <field reporter:label="Holding Code" name="holding_code" reporter:datatype="text"/>
                        <field reporter:label="Holding Type" name="holding_type" reporter:datatype="text"/>
                        <field reporter:label="Holding Link ID" name="holding_link_id" reporter:datatype="int"/>
-                       <field reporter:label="Items" name="items" oils_persist:virtual="true" reporter:datatype="link"/>
                </fields>
                <links>
                        <link field="creator" reltype="has_a" key="id" map="" class="au"/>
                        <link field="editor" reltype="has_a" key="id" map="" class="au"/>
                        <link field="subscription" reltype="has_a" key="id" map="" class="ssub"/>
-                       <link field="items" reltype="has_many" key="id" map="" class="sitem"/>
+                       <link field="caption_and_pattern" reltype="has_a" key="id" map="" class="scap"/>
                </links>
+               <permacrud xmlns="http://open-ils.org/spec/opensrf/IDL/permacrud/v1">
+                       <actions>
+                               <create/>
+                               <retrieve/>
+                               <update/>
+                               <delete/>
+                       </actions>
+               </permacrud>
        </class>
 
-       <class id="sunit" controller="open-ils.cstore" oils_obj:fieldmapper="serial::unit" oils_persist:tablename="serial.unit" reporter:label="Unit">
+       <class id="sunit" controller="open-ils.cstore open-ils.pcrud" oils_obj:fieldmapper="serial::unit" oils_persist:tablename="serial.unit" reporter:label="Unit">
                <fields oils_persist:primary="id" oils_persist:sequence="asset.copy_id_seq">
                        <field reporter:label="ID" name="id" reporter:datatype="id"/>
-            <field reporter:label="Statistical Category Entries" name="stat_cat_entries" oils_persist:virtual="true" reporter:datatype="link"/>
-            <field reporter:label="Age Hold Protection" name="age_protect" reporter:datatype="link"/>
-            <field reporter:label="Alert Message" name="alert_message" reporter:datatype="text"/>
-            <field reporter:label="Barcode" name="barcode" reporter:datatype="text"/>
-            <field reporter:label="Call Number/Volume" name="call_number" reporter:datatype="link"/>
-            <field reporter:label="Circulation Type (MARC)" name="circ_as_type" reporter:datatype="text"/>
-            <field reporter:label="Circulating Library" name="circ_lib"  reporter:datatype="org_unit"/>
-            <field reporter:label="Circulation Modifier" name="circ_modifier" reporter:datatype="link"/>
-            <field reporter:label="Can Circulate" name="circulate" reporter:datatype="bool"/>
-            <field reporter:label="Copy Number on Volume" name="copy_number" reporter:datatype="text"/>
-            <field reporter:label="Creation Date/Time" name="create_date" reporter:datatype="timestamp"/>
-            <field reporter:label="Creating User" name="creator" reporter:datatype="link"/>
-            <field reporter:label="Is Deleted" name="deleted" reporter:datatype="bool"/>
-            <field reporter:label="Dummy ISBN" name="dummy_isbn" reporter:datatype="text"/>
-            <field reporter:label="Is Deposit Required" name="deposit" reporter:datatype="bool"/>
-            <field reporter:label="Deposit Amount" name="deposit_amount" reporter:datatype="money" />
-            <field reporter:label="Precat Dummy Author" name="dummy_author" reporter:datatype="text"/>
-            <field reporter:label="Precat Dummy Title" name="dummy_title" reporter:datatype="text"/>
-            <field reporter:label="Last Edit Date/Time" name="edit_date" reporter:datatype="timestamp"/>
-            <field reporter:label="Last Editing User" name="editor" reporter:datatype="link"/>
-            <field reporter:label="Fine Level" name="fine_level" reporter:datatype="int"/>
-            <field reporter:label="Is Holdable" name="holdable" reporter:datatype="bool" />
-            <field reporter:label="Loan Duration" name="loan_duration" reporter:datatype="int"/>
-            <field reporter:label="Shelving Location" name="location" reporter:datatype="link"/>
-            <field reporter:label="OPAC Visible" name="opac_visible" reporter:datatype="bool" />
-            <field reporter:label="Price" name="price" reporter:datatype="money" />
-            <field reporter:label="Is Reference" name="ref" reporter:datatype="bool"/>
-            <field reporter:label="Copy Status" name="status" reporter:datatype="link"/>
-            <field reporter:label="Copy Status Changed Time" name="status_changed_time" reporter:datatype="timestamp"/>
-            <field reporter:label="Is Mint Condition" name="mint_condition" reporter:datatype="bool"/>
-            <field reporter:label="Is Floating" name="floating" reporter:datatype="bool"/>
-            <field reporter:label="Copy Notes" name="notes" oils_persist:virtual="true" reporter:datatype="link"/>
-            <field reporter:label="Stat-Cat entry maps" name="stat_cat_entry_copy_maps" oils_persist:virtual="true" reporter:datatype="link"/>
-            <field reporter:label="Circulations" name="circulations" oils_persist:virtual="true" reporter:datatype="link"/>
-            <field reporter:label="Total Circulations" name="total_circ_count" oils_persist:virtual="true" reporter:datatype="link"/>
-            <field reporter:label="Holds" name="holds" oils_persist:virtual="true" reporter:datatype="link"/>
-                       <field reporter:label="Label Sort Key" name="label_sort_key" reporter:datatype="text"/>
-                       <field reporter:label="Contents" name="contents" reporter:datatype="text"/>
-                       <field reporter:label="Label" name="label" reporter:datatype="text"/>
-                       <field reporter:label="Serial Items" name="items" oils_persist:virtual="true" reporter:datatype="link"/>
+                       <field reporter:label="Statistical Category Entries" name="stat_cat_entries" oils_persist:virtual="true" reporter:datatype="link"/>
+                       <field reporter:label="Age Hold Protection" name="age_protect" reporter:datatype="link"/>
+                       <field reporter:label="Alert Message" name="alert_message" reporter:datatype="text"/>
+                       <field reporter:label="Barcode" name="barcode" reporter:datatype="text"/>
+                       <field reporter:label="Call Number/Volume" name="call_number" reporter:datatype="link"/>
+                       <field reporter:label="Circulation Type (MARC)" name="circ_as_type" reporter:datatype="text"/>
+                       <field reporter:label="Circulating Library" name="circ_lib"  reporter:datatype="org_unit"/>
+                       <field reporter:label="Circulation Modifier" name="circ_modifier" reporter:datatype="link"/>
+                       <field reporter:label="Can Circulate" name="circulate" reporter:datatype="bool"/>
+                       <field reporter:label="Copy Number on Volume" name="copy_number" reporter:datatype="text"/>
+                       <field reporter:label="Creation Date/Time" name="create_date" reporter:datatype="timestamp"/>
+                       <field reporter:label="Creating User" name="creator" reporter:datatype="link"/>
+                       <field reporter:label="Is Deleted" name="deleted" reporter:datatype="bool"/>
+                       <field reporter:label="Dummy ISBN" name="dummy_isbn" reporter:datatype="text"/>
+                       <field reporter:label="Is Deposit Required" name="deposit" reporter:datatype="bool"/>
+                       <field reporter:label="Deposit Amount" name="deposit_amount" reporter:datatype="money" />
+                       <field reporter:label="Precat Dummy Author" name="dummy_author" reporter:datatype="text"/>
+                       <field reporter:label="Precat Dummy Title" name="dummy_title" reporter:datatype="text"/>
+                       <field reporter:label="Last Edit Date/Time" name="edit_date" reporter:datatype="timestamp"/>
+                       <field reporter:label="Last Editing User" name="editor" reporter:datatype="link"/>
+                       <field reporter:label="Fine Level" name="fine_level" reporter:datatype="int"/>
+                       <field reporter:label="Is Holdable" name="holdable" reporter:datatype="bool" />
+                       <field reporter:label="Loan Duration" name="loan_duration" reporter:datatype="int"/>
+                       <field reporter:label="Shelving Location" name="location" reporter:datatype="link"/>
+                       <field reporter:label="OPAC Visible" name="opac_visible" reporter:datatype="bool" />
+                       <field reporter:label="Price" name="price" reporter:datatype="money" />
+                       <field reporter:label="Is Reference" name="ref" reporter:datatype="bool"/>
+                       <field reporter:label="Copy Status" name="status" reporter:datatype="link"/>
+                       <field reporter:label="Copy Status Changed Time" name="status_changed_time" reporter:datatype="timestamp"/>
+                       <field reporter:label="Is Mint Condition" name="mint_condition" reporter:datatype="bool"/>
+                       <field reporter:label="Is Floating" name="floating" reporter:datatype="bool"/>
+                       <field reporter:label="Copy Notes" name="notes" oils_persist:virtual="true" reporter:datatype="link"/>
+                       <field reporter:label="Stat-Cat entry maps" name="stat_cat_entry_copy_maps" oils_persist:virtual="true" reporter:datatype="link"/>
+                       <field reporter:label="Circulations" name="circulations" oils_persist:virtual="true" reporter:datatype="link"/>
+                       <field reporter:label="Total Circulations" name="total_circ_count" oils_persist:virtual="true" reporter:datatype="link"/>
+                       <field reporter:label="Holds" name="holds" oils_persist:virtual="true" reporter:datatype="link"/>
+                       <field reporter:label="Sort Key" name="sort_key" reporter:datatype="text"/>
+                       <field reporter:label="Summary Contents" name="summary_contents" reporter:datatype="text"/>
+                       <field reporter:label="Detailed Contents" name="detailed_contents" reporter:datatype="text"/>
                </fields>
                <links>
-            <link field="age_protect" reltype="has_a" key="id" map="" class="crahp"/>
-            <link field="call_number" reltype="has_a" key="id" map="" class="acn"/>
-            <link field="location" reltype="has_a" key="id" map="" class="acpl"/>
-            <link field="editor" reltype="has_a" key="id" map="" class="au"/>
-            <link field="creator" reltype="has_a" key="id" map="" class="au"/>
-            <link field="status" reltype="has_a" key="id" map="" class="ccs"/>
-            <link field="circ_lib" reltype="has_a" key="id" map="" class="aou"/>
-            <link field="holds" reltype="has_many" key="target_copy" map="hold" class="ahcm"/>
-            <link field="stat_cat_entry_copy_maps" reltype="has_many" key="owning_copy" map="" class="ascecm"/>
-            <link field="notes" reltype="has_many" key="owning_copy" map="" class="acpn"/>
-            <link field="stat_cat_entries" reltype="has_many" key="owning_copy" map="stat_cat_entry" class="ascecm"/>
-            <link field="circulations" reltype="has_many" key="target_copy" map="" class="circ"/>
-            <link field="total_circ_count" reltype="might_have" key="id" map="" class="erfcc"/>
-            <link field="circ_modifier" reltype="has_a" key="code" map="" class="ccm"/>
-            <link field="items" reltype="has_many" key="id" map="" class="sitem"/>
+                       <link field="age_protect" reltype="has_a" key="id" map="" class="crahp"/>
+                       <link field="call_number" reltype="has_a" key="id" map="" class="acn"/>
+                       <link field="location" reltype="has_a" key="id" map="" class="acpl"/>
+                       <link field="editor" reltype="has_a" key="id" map="" class="au"/>
+                       <link field="creator" reltype="has_a" key="id" map="" class="au"/>
+                       <link field="status" reltype="has_a" key="id" map="" class="ccs"/>
+                       <link field="circ_lib" reltype="has_a" key="id" map="" class="aou"/>
+                       <link field="holds" reltype="has_many" key="target_copy" map="hold" class="ahcm"/>
+                       <link field="stat_cat_entry_copy_maps" reltype="has_many" key="owning_copy" map="" class="ascecm"/>
+                       <link field="notes" reltype="has_many" key="owning_copy" map="" class="acpn"/>
+                       <link field="stat_cat_entries" reltype="has_many" key="owning_copy" map="stat_cat_entry" class="ascecm"/>
+                       <link field="circulations" reltype="has_many" key="target_copy" map="" class="circ"/>
+                       <link field="total_circ_count" reltype="might_have" key="id" map="" class="erfcc"/>
+                       <link field="circ_modifier" reltype="has_a" key="code" map="" class="ccm"/>
                </links>
                <permacrud xmlns="http://open-ils.org/spec/opensrf/IDL/permacrud/v1">
+                       <actions>
+                               <create/>
+                               <retrieve/>
+                               <update/>
+                               <delete/>
+                       </actions>
                </permacrud>
        </class>
 
@@ -3254,7 +3317,9 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
                        <field reporter:label="URI" name="uri" reporter:datatype="link"/>
                        <field reporter:label="Date Expected" name="date_expected" reporter:datatype="timestamp"/>
                        <field reporter:label="Date Received" name="date_received" reporter:datatype="timestamp"/>
+                       <field reporter:label="Status" name="status" reporter:datatype="text"/>
                        <field reporter:label="Notes" name="notes" oils_persist:virtual="true" reporter:datatype="link"/>
+                       <field reporter:label="Shadowed?" name="shadowed" reporter:datatype="bool"/>
                </fields>
                <links>
                        <link field="creator" reltype="has_a" key="id" map="" class="au"/>
@@ -3263,9 +3328,15 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
                        <link field="stream" reltype="has_a" key="id" map="" class="sstr"/>
                        <link field="unit" reltype="has_a" key="id" map="" class="sunit"/>
                        <link field="uri" reltype="has_a" key="id" map="" class="auri"/>
-                       <link field="notes" reltype="has_many" key="id" map="" class="sin"/>
+                       <link field="notes" reltype="has_many" key="item" map="" class="sin"/>
                </links>
                <permacrud xmlns="http://open-ils.org/spec/opensrf/IDL/permacrud/v1">
+                       <actions>
+                               <create/>
+                               <retrieve/>
+                               <update/>
+                               <delete/>
+                       </actions>
                </permacrud>
        </class>
 
@@ -3284,11 +3355,17 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
                        <link field="creator" reltype="has_a" key="id" map="" class="au"/>
                </links>
                <permacrud xmlns="http://open-ils.org/spec/opensrf/IDL/permacrud/v1">
+                       <actions>
+                               <create/>
+                               <retrieve/>
+                               <update/>
+                               <delete/>
+                       </actions>
                </permacrud>
        </class>
 
-       <class id="sbsum" controller="open-ils.cstore" oils_obj:fieldmapper="serial::bib_summary" oils_persist:tablename="serial.bib_summary" reporter:label="Bib Summary">
-               <fields oils_persist:primary="id" oils_persist:sequence="serial.bib_summary_id_seq">
+       <class id="sbsum" controller="open-ils.cstore open-ils.pcrud" oils_obj:fieldmapper="serial::basic_summary" oils_persist:tablename="serial.basic_summary" reporter:label="Basic Issue Summary">
+               <fields oils_persist:primary="id" oils_persist:sequence="serial.basic_summary_id_seq">
                        <field name="id" reporter:datatype="id" />
                        <field name="distribution" reporter:datatype="link"/>
                        <field name="generated_coverage" reporter:datatype="text"/>
@@ -3297,9 +3374,17 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
                <links>
                        <link field="distribution" reltype="has_a" key="id" map="" class="sdist"/>
                </links>
+               <permacrud xmlns="http://open-ils.org/spec/opensrf/IDL/permacrud/v1">
+                       <actions>
+                               <create/>
+                               <retrieve/>
+                               <update/>
+                               <delete/>
+                       </actions>
+               </permacrud>
        </class>
 
-       <class id="sssum" controller="open-ils.cstore" oils_obj:fieldmapper="serial::sup_summary" oils_persist:tablename="serial.sup_summary" reporter:label="Supplemental Issue Summary">
+       <class id="sssum" controller="open-ils.cstore open-ils.pcrud" oils_obj:fieldmapper="serial::supplement_summary" oils_persist:tablename="serial.supplement_summary" reporter:label="Supplemental Issue Summary">
                <fields oils_persist:primary="id" oils_persist:sequence="serial.sup_summary_id_seq">
                        <field name="id" reporter:datatype="id" />
                        <field name="distribution" reporter:datatype="link"/>
@@ -3309,9 +3394,17 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
                <links>
                        <link field="distribution" reltype="has_a" key="id" map="" class="sdist"/>
                </links>
+               <permacrud xmlns="http://open-ils.org/spec/opensrf/IDL/permacrud/v1">
+                       <actions>
+                               <create/>
+                               <retrieve/>
+                               <update/>
+                               <delete/>
+                       </actions>
+               </permacrud>
        </class>
 
-       <class id="sisum" controller="open-ils.cstore" oils_obj:fieldmapper="serial::index_summary" oils_persist:tablename="serial.index_summary" reporter:label="Index Summary">
+       <class id="sisum" controller="open-ils.cstore open-ils.pcrud" oils_obj:fieldmapper="serial::index_summary" oils_persist:tablename="serial.index_summary" reporter:label="Index Issue Summary">
                <fields oils_persist:primary="id" oils_persist:sequence="serial.index_summary_id_seq">
                        <field name="id" reporter:datatype="id" />
                        <field name="distribution" reporter:datatype="link"/>
@@ -3321,6 +3414,14 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
                <links>
                        <link field="distribution" reltype="has_a" key="id" map="" class="sdist"/>
                </links>
+               <permacrud xmlns="http://open-ils.org/spec/opensrf/IDL/permacrud/v1">
+                       <actions>
+                               <create/>
+                               <retrieve/>
+                               <update/>
+                               <delete/>
+                       </actions>
+               </permacrud>
        </class>
 
        <class id="ascecm" controller="open-ils.cstore" oils_obj:fieldmapper="asset::stat_cat_entry_copy_map" oils_persist:tablename="asset.stat_cat_entry_copy_map" reporter:label="Statistical Category Entry Copy Map">
index d656461..d0e0bd1 100644 (file)
@@ -68,7 +68,7 @@ CREATE TABLE config.upgrade_log (
     install_date    TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW()
 );
 
-INSERT INTO config.upgrade_log (version) VALUES ('0351'); -- Scott McKellar
+INSERT INTO config.upgrade_log (version) VALUES ('0352'); -- Scott McKellar
 
 CREATE TABLE config.bib_source (
        id              SERIAL  PRIMARY KEY,
index 2235c36..f1638e8 100644 (file)
@@ -30,7 +30,7 @@ CREATE RULE protect_mfhd_delete AS ON DELETE TO serial.record_entry DO INSTEAD U
 
 CREATE TABLE serial.subscription (
        id                     SERIAL       PRIMARY KEY,
-       owning_lib             INT     NOT NULL DEFAULT 1 REFERENCES actor.org_unit (id) ON DELETE SET NULL DEFERRABLE INITIALLY DEFERRED,
+       owning_lib             INT          NOT NULL DEFAULT 1 REFERENCES actor.org_unit (id) ON DELETE SET NULL DEFERRABLE INITIALLY DEFERRED,
        start_date             TIMESTAMP WITH TIME ZONE     NOT NULL,
        end_date               TIMESTAMP WITH TIME ZONE,    -- interpret NULL as current subscription
        record_entry           BIGINT       REFERENCES biblio.record_entry (id)
@@ -40,6 +40,20 @@ CREATE TABLE serial.subscription (
        -- acquisitions/business-side tables link to here
 );
 
+CREATE TABLE serial.subscription_note (
+       id           SERIAL PRIMARY KEY,
+       subscription INT    NOT NULL
+                           REFERENCES serial.subscription (id)
+                           ON DELETE CASCADE
+                           DEFERRABLE INITIALLY DEFERRED,
+       creator      INT    NOT NULL
+                           REFERENCES actor.usr (id)
+                           DEFERRABLE INITIALLY DEFERRED,
+       create_date  TIMESTAMP WITH TIME ZONE DEFAULT NOW(),
+       pub          BOOL   NOT NULL DEFAULT FALSE,
+       title        TEXT   NOT NULL,
+       value        TEXT   NOT NULL
+);
 
 CREATE TABLE serial.caption_and_pattern (
        id           SERIAL       PRIMARY KEY,
@@ -50,7 +64,7 @@ CREATE TABLE serial.caption_and_pattern (
        type         TEXT         NOT NULL
                                  CONSTRAINT cap_type CHECK ( type in
                                  ( 'basic', 'supplement', 'index' )),
-       create_time  TIMESTAMPTZ  NOT NULL DEFAULT now(),
+       create_date  TIMESTAMPTZ  NOT NULL DEFAULT now(),
        active       BOOL         NOT NULL DEFAULT FALSE,
        pattern_code TEXT         NOT NULL,       -- must contain JSON
        enum_1       TEXT,
@@ -88,11 +102,26 @@ CREATE TABLE serial.distribution (
                                      DEFERRABLE INITIALLY DEFERRED,
        bind_unit_template    INT     REFERENCES asset.copy_template (id)
                                      DEFERRABLE INITIALLY DEFERRED,
-       unit_label_base       TEXT,
+       unit_label_prefix     TEXT,
        unit_label_suffix     TEXT
 );
 CREATE UNIQUE INDEX one_dist_per_sre_idx ON serial.distribution (record_entry);
 
+CREATE TABLE serial.distribution_note (
+       id           SERIAL PRIMARY KEY,
+       distribution INT    NOT NULL
+                           REFERENCES serial.distribution (id)
+                           ON DELETE CASCADE
+                           DEFERRABLE INITIALLY DEFERRED,
+       creator      INT    NOT NULL
+                           REFERENCES actor.usr (id)
+                           DEFERRABLE INITIALLY DEFERRED,
+       create_date  TIMESTAMP WITH TIME ZONE DEFAULT NOW(),
+       pub          BOOL   NOT NULL DEFAULT FALSE,
+       title        TEXT   NOT NULL,
+       value        TEXT   NOT NULL
+);
+
 CREATE TABLE serial.stream (
        id              SERIAL  PRIMARY KEY,
        distribution    INT     NOT NULL
@@ -143,20 +172,22 @@ CREATE TABLE serial.issuance (
                                  DEFERRABLE INITIALLY DEFERRED,
        label           TEXT,
        date_published  TIMESTAMP WITH TIME ZONE,
+       caption_and_pattern INT   REFERENCES serial.caption_and_pattern (id)
+                                 DEFERRABLE INITIALLY DEFERRED,
        holding_code    TEXT,
        holding_type    TEXT      CONSTRAINT valid_holding_type CHECK
                                  (
                                      holding_type IS NULL
                                      OR holding_type IN ('basic','supplement','index')
                                  ),
-       holding_link_id INT
+       holding_link_id INT -- probably defunct
        -- TODO: add columns for separate enumeration/chronology values
 );
 
 CREATE TABLE serial.unit (
-       label           TEXT,
-       label_sort_key  TEXT,
-       contents        TEXT    NOT NULL
+       sort_key          TEXT,
+       detailed_contents TEXT    NOT NULL,
+       summary_contents  TEXT    NOT NULL
 ) INHERITS (asset.copy);
 
 ALTER TABLE serial.unit ADD PRIMARY KEY (id);
@@ -190,6 +221,11 @@ CREATE TABLE serial.item (
                                DEFERRABLE INITIALLY DEFERRED,
        date_expected   TIMESTAMP WITH TIME ZONE,
        date_received   TIMESTAMP WITH TIME ZONE
+       status          TEXT    CONSTRAINT valid_status CHECK
+                               (
+                                   status IN ('Bindery', 'Bound', 'Claimed', 'Discarded', 'Expected', 'Not Held', 'Not Published', 'Received')
+                               ) DEFAULT 'Expected',
+       shadowed        BOOL    NOT NULL DEFAULT FALSE -- ignore when generating summaries/labels
 );
 
 CREATE TABLE serial.item_note (
@@ -207,7 +243,7 @@ CREATE TABLE serial.item_note (
        value       TEXT    NOT NULL
 );
 
-CREATE TABLE serial.bib_summary (
+CREATE TABLE serial.basic_summary (
        id                  SERIAL  PRIMARY KEY,
        distribution        INT     NOT NULL
                                    REFERENCES serial.distribution (id)
@@ -217,7 +253,7 @@ CREATE TABLE serial.bib_summary (
        textual_holdings    TEXT
 );
 
-CREATE TABLE serial.sup_summary (
+CREATE TABLE serial.supplement_summary (
        id                  SERIAL  PRIMARY KEY,
        distribution        INT     NOT NULL
                                    REFERENCES serial.distribution (id)
@@ -238,3 +274,4 @@ CREATE TABLE serial.index_summary (
 );
 
 COMMIT;
+
diff --git a/Open-ILS/src/sql/Pg/upgrade/0352.schema.serials-integration.sql b/Open-ILS/src/sql/Pg/upgrade/0352.schema.serials-integration.sql
new file mode 100644 (file)
index 0000000..5f6c042
--- /dev/null
@@ -0,0 +1,80 @@
+-- Apply Dan Wells' changes to the serial schema, from the
+-- seials-integration branch
+
+BEGIN;
+
+INSERT INTO config.upgrade_log (version) VALUES ('0352'); -- Scott McKellar
+
+CREATE TABLE serial.subscription_note (
+       id           SERIAL PRIMARY KEY,
+       subscription INT    NOT NULL
+                           REFERENCES serial.subscription (id)
+                           ON DELETE CASCADE
+                           DEFERRABLE INITIALLY DEFERRED,
+       creator      INT    NOT NULL
+                           REFERENCES actor.usr (id)
+                           DEFERRABLE INITIALLY DEFERRED,
+       create_date  TIMESTAMP WITH TIME ZONE DEFAULT NOW(),
+       pub          BOOL   NOT NULL DEFAULT FALSE,
+       title        TEXT   NOT NULL,
+       value        TEXT   NOT NULL
+);
+
+ALTER TABLE serial.caption_and_pattern
+RENAME COLUMN create_time TO create_date;
+
+ALTER TABLE serial.distribution
+RENAME COLUMN unit_label_base TO unit_label_prefix;
+
+CREATE TABLE serial.distribution_note (
+       id           SERIAL PRIMARY KEY,
+       distribution INT    NOT NULL
+                           REFERENCES serial.distribution (id)
+                           ON DELETE CASCADE
+                           DEFERRABLE INITIALLY DEFERRED,
+       creator      INT    NOT NULL
+                           REFERENCES actor.usr (id)
+                           DEFERRABLE INITIALLY DEFERRED,
+       create_date  TIMESTAMP WITH TIME ZONE DEFAULT NOW(),
+       pub          BOOL   NOT NULL DEFAULT FALSE,
+       title        TEXT   NOT NULL,
+       value        TEXT   NOT NULL
+);
+
+ALTER TABLE serial.issuance
+ADD COLUMN caption_and_pattern   INT   REFERENCES serial.caption_and_pattern (id)
+                                       DEFERRABLE INITIALLY DEFERRED;
+------- Begin surgery on serial.unit
+
+ALTER TABLE serial.unit
+       DROP COLUMN label;
+
+ALTER TABLE serial.unit
+       RENAME COLUMN label_sort_key TO sort_key;
+
+ALTER TABLE serial.unit
+       RENAME COLUMN contents TO detailed_contents;
+
+ALTER TABLE serial.unit
+       ADD COLUMN summary_contents TEXT;
+
+UPDATE serial.unit
+SET summary_contents = detailed_contents;
+
+ALTER TABLE serial.unit
+       ALTER column summary_contents SET NOT NULL;
+
+------- End surgery on serial.unit
+
+ALTER TABLE serial.item
+ADD COLUMN status        TEXT          CONSTRAINT value_status_check CHECK (
+                                       status IN ( 'Bindery', 'Bound', 'Claimed', 'Discarded',
+                                       'Expected', 'Not Held', 'Not Published', 'Received'))
+                                       DEFAULT 'Expected',
+ADD COLUMN  shadowed     BOOL          NOT NULL DEFAULT FALSE;
+
+ALTER TABLE serial.bib_summary RENAME TO basic_summary;
+
+ALTER TABLE serial.sup_summary RENAME TO supplement_summary;
+
+COMMIT;