New table: actor.usr_saved_search
authorscottmk <scottmk@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Mon, 26 Jul 2010 16:18:09 +0000 (16:18 +0000)
committerscottmk <scottmk@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Mon, 26 Jul 2010 16:18:09 +0000 (16:18 +0000)
M    Open-ILS/src/sql/Pg/005.schema.actors.sql
M    Open-ILS/src/sql/Pg/002.schema.config.sql
A    Open-ILS/src/sql/Pg/upgrade/0351.schema.usr_saved_search.sql
M    Open-ILS/examples/fm_IDL.xml

git-svn-id: svn://svn.open-ils.org/ILS/trunk@17034 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/005.schema.actors.sql
Open-ILS/src/sql/Pg/upgrade/0351.schema.usr_saved_search.sql [new file with mode: 0644]

index 32c8242..00d2ca5 100644 (file)
@@ -2385,6 +2385,24 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
                        <link field="replaces" reltype="has_a" key="id" map="" class="aua"/>
                </links>
        </class>
                        <link field="replaces" reltype="has_a" key="id" map="" class="aua"/>
                </links>
        </class>
+
+       <class id="auss" controller="open-ils.cstore open-ils.pcrud" oils_obj:fieldmapper="actor::usr_saved_search" oils_persist:tablename="actor.usr_saved_search" reporter:label="User Saved Search">
+               <fields oils_persist:primary="id" oils_persist:sequence="usr_saved_search_id_seq">
+                       <field reporter:label="ID" name="id" reporter:datatype="id"/>
+                       <field reporter:label="Owner" name="owner" reporter:datatype="link"/>
+                       <field reporter:label="Name" name="name" reporter:datatype="text"/>
+                       <field reporter:label="Create Date" name="create_date" reporter:datatype="timestamp"/>
+                       <field reporter:label="Query Text" name="query_text" reporter:datatype="text"/>
+                       <field reporter:label="Query Type" name="query_type" reporter:datatype="text"/>
+                       <field reporter:label="Target" name="target" reporter:datatype="text"/>
+               </fields>
+               <links>
+                       <link field="owner" reltype="has_a" key="id" map="" class="au"/>
+               </links>
+               <permacrud xmlns="http://open-ils.org/spec/opensrf/IDL/permacrud/v1">
+               </permacrud>
+       </class>
+
        <class id="acnn" controller="open-ils.cstore open-ils.pcrud" oils_obj:fieldmapper="asset::call_number_note" oils_persist:tablename="asset.call_number_note" reporter:label="Call Number Note">
                <fields oils_persist:primary="id" oils_persist:sequence="asset.call_number_note_id_seq">
                        <field name="call_number" />
        <class id="acnn" controller="open-ils.cstore open-ils.pcrud" oils_obj:fieldmapper="asset::call_number_note" oils_persist:tablename="asset.call_number_note" reporter:label="Call Number Note">
                <fields oils_persist:primary="id" oils_persist:sequence="asset.call_number_note_id_seq">
                        <field name="call_number" />
index 64539f0..d656461 100644 (file)
@@ -68,7 +68,7 @@ CREATE TABLE config.upgrade_log (
     install_date    TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW()
 );
 
     install_date    TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW()
 );
 
-INSERT INTO config.upgrade_log (version) VALUES ('0350'); -- Scott McKellar
+INSERT INTO config.upgrade_log (version) VALUES ('0351'); -- Scott McKellar
 
 CREATE TABLE config.bib_source (
        id              SERIAL  PRIMARY KEY,
 
 CREATE TABLE config.bib_source (
        id              SERIAL  PRIMARY KEY,
index f65ca48..91d4eee 100644 (file)
@@ -608,4 +608,22 @@ CREATE INDEX actor_usr_standing_penalty_usr_idx ON actor.usr_standing_penalty (u
 CREATE INDEX actor_usr_standing_penalty_staff_idx ON actor.usr_standing_penalty ( staff );
 
 
 CREATE INDEX actor_usr_standing_penalty_staff_idx ON actor.usr_standing_penalty ( staff );
 
 
+CREATE TABLE actor.usr_saved_search (
+    id              SERIAL          PRIMARY KEY,
+       owner           INT             NOT NULL REFERENCES actor.usr (id)
+                                       ON DELETE CASCADE
+                                       DEFERRABLE INITIALLY DEFERRED,
+       name            TEXT            NOT NULL,
+       create_date     TIMESTAMPTZ     NOT NULL DEFAULT now(),
+       query_text      TEXT            NOT NULL,
+       query_type      TEXT            NOT NULL
+                                       CONSTRAINT valid_query_text CHECK (
+                                       query_type IN ( 'URL' )) DEFAULT 'URL',
+                                       -- we may add other types someday
+       target          TEXT            NOT NULL
+                                       CONSTRAINT valid_target CHECK (
+                                       target IN ( 'record', 'metarecord', 'callnumber' )),
+       CONSTRAINT name_once_per_user UNIQUE (owner, name)
+);
+
 COMMIT;
 COMMIT;
diff --git a/Open-ILS/src/sql/Pg/upgrade/0351.schema.usr_saved_search.sql b/Open-ILS/src/sql/Pg/upgrade/0351.schema.usr_saved_search.sql
new file mode 100644 (file)
index 0000000..e0842df
--- /dev/null
@@ -0,0 +1,23 @@
+BEGIN;
+
+INSERT INTO config.upgrade_log (version) VALUES ('0351'); -- Scott McKellar
+
+CREATE TABLE actor.usr_saved_search (
+    id              SERIAL          PRIMARY KEY,
+       owner           INT             NOT NULL REFERENCES actor.usr (id)
+                                       ON DELETE CASCADE
+                                       DEFERRABLE INITIALLY DEFERRED,
+       name            TEXT            NOT NULL,
+       create_date     TIMESTAMPTZ     NOT NULL DEFAULT now(),
+       query_text      TEXT            NOT NULL,
+       query_type      TEXT            NOT NULL
+                                       CONSTRAINT valid_query_text CHECK (
+                                       query_type IN ( 'URL' )) DEFAULT 'URL',
+                                       -- we may add other types someday
+       target          TEXT            NOT NULL
+                                       CONSTRAINT valid_target CHECK (
+                                       target IN ( 'record', 'metarecord', 'callnumber' )),
+       CONSTRAINT name_once_per_user UNIQUE (owner, name)
+);
+
+COMMIT;