1. Add table: serial.caption_and_pattern
authorscottmk <scottmk@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Mon, 7 Jun 2010 18:41:21 +0000 (18:41 +0000)
committerscottmk <scottmk@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Mon, 7 Jun 2010 18:41:21 +0000 (18:41 +0000)
2. In serial.record entry: make "marc" row nullable.

M    Open-ILS/src/sql/Pg/002.schema.config.sql
A    Open-ILS/src/sql/Pg/upgrade/0297.schema.serial-caption-and-pattern.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@16618 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/0297.schema.serial-caption-and-pattern.sql [new file with mode: 0644]

index 6040f79..e3470b7 100644 (file)
@@ -3011,6 +3011,33 @@ 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">
+               <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="Record" name="record" 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="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"/>
+                       <field reporter:label="Enum 2" name="enum_2" reporter:datatype="text"/>
+                       <field reporter:label="Enum 3" name="enum_3" reporter:datatype="text"/>
+                       <field reporter:label="Enum 4" name="enum_4" reporter:datatype="text"/>
+                       <field reporter:label="Enum 5" name="enum_5" reporter:datatype="text"/>
+                       <field reporter:label="Enum 6" name="enum_6" reporter:datatype="text"/>
+                       <field reporter:label="Chron 1" name="chron_1" reporter:datatype="text"/>
+                       <field reporter:label="Chron 2" name="chron_2" reporter:datatype="text"/>
+                       <field reporter:label="Chron 3" name="chron_3" reporter:datatype="text"/>
+                       <field reporter:label="Chron 4" name="chron_4" reporter:datatype="text"/>
+                       <field reporter:label="Chron 5" name="chron_5" reporter:datatype="text"/>
+               </fields>
+               <links>
+                       <link field="record" reltype="has_a" key="id" map="" class="sre"/>
+               </links>
+               <permacrud xmlns="http://open-ils.org/spec/opensrf/IDL/permacrud/v1">
+               </permacrud>
+       </class>
+
        <class id="ssub" controller="open-ils.cstore" oils_obj:fieldmapper="serial::subscription" oils_persist:tablename="serial.subscription" reporter:label="Subscription">
                <fields oils_persist:primary="id" oils_persist:sequence="serial.subscription_id_seq">
                        <field reporter:label="Id" name="id" reporter:datatype="id"/>
index 2e26804..93f25a6 100644 (file)
@@ -65,7 +65,7 @@ CREATE TABLE config.upgrade_log (
     install_date    TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW()
 );
 
-INSERT INTO config.upgrade_log (version) VALUES ('0296'); -- gmcharlt
+INSERT INTO config.upgrade_log (version) VALUES ('0297'); -- Scott McKellar
 
 CREATE TABLE config.bib_source (
        id              SERIAL  PRIMARY KEY,
index d0edba9..29663bd 100644 (file)
@@ -17,7 +17,7 @@ CREATE TABLE serial.record_entry (
        edit_date       TIMESTAMP WITH TIME ZONE        NOT NULL DEFAULT now(),
        active          BOOL            NOT NULL DEFAULT TRUE,
        deleted         BOOL            NOT NULL DEFAULT FALSE,
-       marc            TEXT            NOT NULL,
+       marc            TEXT,
        last_xact_id    TEXT            NOT NULL
 );
 CREATE INDEX serial_record_entry_creator_idx ON serial.record_entry ( creator );
@@ -26,6 +26,31 @@ CREATE INDEX serial_record_entry_owning_lib_idx ON serial.record_entry ( owning_
 
 CREATE RULE protect_mfhd_delete AS ON DELETE TO serial.record_entry DO INSTEAD UPDATE serial.record_entry SET deleted = true WHERE old.id = serial.record_entry.id;
 
+CREATE TABLE serial.caption_and_pattern (
+       id           SERIAL       PRIMARY KEY,
+       record       BIGINT       NOT NULL
+                                 REFERENCES serial.record_entry (id)
+                                 ON DELETE CASCADE
+                                 DEFERRABLE INITIALLY DEFERRED,
+       type         TEXT         NOT NULL
+                                 CONSTRAINT cap_type CHECK ( type in
+                                 ( 'basic', 'supplement', 'index' )),
+       create_time  TIMESTAMPTZ  NOT NULL DEFAULT now(),
+       active       BOOL         NOT NULL DEFAULT FALSE,
+       pattern_code TEXT         NOT NULL,       -- must contain JSON
+       enum_1       TEXT,
+       enum_2       TEXT,
+       enum_3       TEXT,
+       enum_4       TEXT,
+       enum_5       TEXT,
+       enum_6       TEXT,
+       chron_1      TEXT,
+       chron_2      TEXT,
+       chron_3      TEXT,
+       chron_4      TEXT,
+       chron_5      TEXT
+);
+
 CREATE TABLE serial.subscription (
        id                     SERIAL       PRIMARY KEY,
        start_date             TIMESTAMP WITH TIME ZONE     NOT NULL,
diff --git a/Open-ILS/src/sql/Pg/upgrade/0297.schema.serial-caption-and-pattern.sql b/Open-ILS/src/sql/Pg/upgrade/0297.schema.serial-caption-and-pattern.sql
new file mode 100644 (file)
index 0000000..20d1303
--- /dev/null
@@ -0,0 +1,33 @@
+BEGIN;
+
+INSERT INTO config.upgrade_log (version) VALUES ('0297'); -- Scott McKellar
+
+ALTER TABLE serial.record_entry
+       ALTER COLUMN marc DROP NOT NULL;
+
+CREATE TABLE serial.caption_and_pattern (
+       id           SERIAL       PRIMARY KEY,
+       record       BIGINT       NOT NULL
+                                 REFERENCES serial.record_entry (id)
+                                 ON DELETE CASCADE
+                                 DEFERRABLE INITIALLY DEFERRED,
+       type         TEXT         NOT NULL
+                                 CONSTRAINT cap_type CHECK ( type in
+                                 ( 'basic', 'supplement', 'index' )),
+       create_time  TIMESTAMPTZ  NOT NULL DEFAULT now(),
+       active       BOOL         NOT NULL DEFAULT FALSE,
+       pattern_code TEXT         NOT NULL,       -- must contain JSON
+       enum_1       TEXT,
+       enum_2       TEXT,
+       enum_3       TEXT,
+       enum_4       TEXT,
+       enum_5       TEXT,
+       enum_6       TEXT,
+       chron_1      TEXT,
+       chron_2      TEXT,
+       chron_3      TEXT,
+       chron_4      TEXT,
+       chron_5      TEXT
+);
+
+COMMIT;