add explicit link from resource_type to biblio.record_entry
authormiker <miker@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Tue, 24 Nov 2009 15:28:34 +0000 (15:28 +0000)
committermiker <miker@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Tue, 24 Nov 2009 15:28:34 +0000 (15:28 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@15019 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/095.schema.booking.sql
Open-ILS/src/sql/Pg/upgrade/0090.schema.booking.bib-base-types.sql [new file with mode: 0644]

index 161859e..5f35b32 100644 (file)
@@ -2341,6 +2341,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
                        <field reporter:label="Fine Amount" name="fine_amount" reporter:datatype="money"/>
                        <field reporter:label="Owning Library" name="owner" reporter:datatype="org_unit"/>
                        <field reporter:label="Catalog Item" name="catalog_item" reporter:datatype="bool"/>
+                       <field reporter:label="Bibliographic Record" name="record" reporter:datatype="link"/>
                        <field reporter:label="Transferable" name="transferable" reporter:datatype="bool"/>
                        <field reporter:label="Resources" name="resources" oils_persist:virtual="true" reporter:datatype="link"/>
                        <field reporter:label="Resource Attributes" name="resource_attrs" oils_persist:virtual="true" reporter:datatype="link"/>
@@ -2348,6 +2349,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
                </fields>
                <links>
                        <link field="owner" reltype="has_a" key="id" map="" class="aou"/>
+                       <link field="record" reltype="has_a" key="id" map="" class="bre"/>
                        <link field="resources" reltype="has_many" key="type" map="" class="brsrc"/>
                        <link field="resource_attrs" reltype="has_many" key="type" map="" class="bra"/>
                        <link field="tgt_rsrc_types" reltype="has_many" key="type" map="" class="bresv"/>
index 0b06c6b..4bce49f 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 ('0089'); -- berick
+INSERT INTO config.upgrade_log (version) VALUES ('0090'); -- miker
 
 CREATE TABLE config.bib_source (
        id              SERIAL  PRIMARY KEY,
index 6063ed3..32840be 100644 (file)
@@ -30,7 +30,9 @@ CREATE TABLE booking.resource_type (
                                       DEFERRABLE INITIALLY DEFERRED,
        catalog_item   BOOLEAN         NOT NULL DEFAULT FALSE,
        transferable   BOOLEAN         NOT NULL DEFAULT FALSE,
-       CONSTRAINT brt_name_once_per_owner UNIQUE(owner, name)
+    record         INT             REFERENCES biblio.record_entry (id)
+                                   DEFERRABLE INITIALLY DEFERRED,
+       CONSTRAINT brt_name_once_per_owner UNIQUE(owner, name, record)
 );
 
 CREATE TABLE booking.resource (
diff --git a/Open-ILS/src/sql/Pg/upgrade/0090.schema.booking.bib-base-types.sql b/Open-ILS/src/sql/Pg/upgrade/0090.schema.booking.bib-base-types.sql
new file mode 100644 (file)
index 0000000..2ee8bb7
--- /dev/null
@@ -0,0 +1,9 @@
+BEGIN;
+
+INSERT INTO config.upgrade_log (version) VALUES ('0090'); -- miker
+
+ALTER TABLE booking.resource_type DROP CONSTRAINT brt_name_once_per_owner;
+ALTER TABLE booking.resource_type ADD COLUMN record BIGINT REFERENCES biblio.record_entry (id) DEFERRABLE INITIALLY DEFERRED;
+ALTER TABLE booking.resource_type ADD CONSTRAINT brt_name_or_record_once_per_owner UNIQUE(owner, name, record);
+
+COMMIT;