From: scottmk <scottmk@dcc99617-32d9-48b4-a31d-7c20da2025e4> Date: Thu, 25 Mar 2010 13:31:06 +0000 (+0000) Subject: Create two tables in acq schema: claim_policy and claim_policy_action. X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=c78eb22d3326c5ac3c9cea3f84af99a7352afca6;p=contrib%2FConifer.git Create two tables in acq schema: claim_policy and claim_policy_action. 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/0210.schema.acq.claim-policy.sql M Open-ILS/examples/fm_IDL.xml git-svn-id: svn://svn.open-ils.org/ILS/trunk@15972 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- diff --git a/Open-ILS/examples/fm_IDL.xml b/Open-ILS/examples/fm_IDL.xml index 1d5e262345..9bb7529f25 100644 --- a/Open-ILS/examples/fm_IDL.xml +++ b/Open-ILS/examples/fm_IDL.xml @@ -6034,6 +6034,35 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA </permacrud> </class> + <class id="acqclp" controller="open-ils.cstore open-ils.pcrud" oils_obj:fieldmapper="acq::claim_policy" oils_persist:tablename="acq.claim_policy" reporter:label="Claim Policy"> + <fields oils_persist:primary="id" oils_persist:sequence="acq.claim_policy_id_seq"> + <field reporter:label="ID" name="id" reporter:datatype="id"/> + <field reporter:label="Org Unit" name="org_unit" reporter:datatype="org_unit"/> + <field reporter:label="Claim Policy Name" name="name" reporter:datatype="text"/> + <field reporter:label="Description" name="description" reporter:datatype="text"/> + </fields> + <links> + <link field="org_unit" reltype="has_a" key="id" map="" class="aou"/> + </links> + <permacrud xmlns="http://open-ils.org/spec/opensrf/IDL/permacrud/v1"> + </permacrud> + </class> + + <class id="acqclpa" controller="open-ils.cstore open-ils.pcrud" oils_obj:fieldmapper="acq::claim_policy_action" oils_persist:tablename="acq.claim_policy_action" reporter:label="Claim Policy Action"> + <fields oils_persist:primary="id" oils_persist:sequence="acq.claim_policy_action_id_seq"> + <field reporter:label="ID" name="id" reporter:datatype="id"/> + <field reporter:label="Claim Policy ID" name="claim_policy" reporter:datatype="link"/> + <field reporter:label="Action Interval" name="action_interval" reporter:datatype="interval"/> + <field reporter:label="Action" name="action" reporter:datatype="link"/> + </fields> + <links> + <link field="claim_policy" reltype="has_a" key="id" map="" class="acqclp"/> + <link field="action" reltype="has_a" key="id" map="" class="acqclet"/> + </links> + <permacrud xmlns="http://open-ils.org/spec/opensrf/IDL/permacrud/v1"> + </permacrud> + </class> + <class id="stgu" controller="open-ils.cstore" oils_obj:fieldmapper="staging::user_stage" oils_persist:tablename="staging.user_stage" reporter:label="User Stage"> <fields oils_persist:primary="row_id" oils_persist:sequence="staging.usr_stage_row_id_seq"> <field reporter:label="Row ID" name="row_id" reporter:datatype="id"/> diff --git a/Open-ILS/src/sql/Pg/002.schema.config.sql b/Open-ILS/src/sql/Pg/002.schema.config.sql index da31d66232..50fea244c9 100644 --- a/Open-ILS/src/sql/Pg/002.schema.config.sql +++ b/Open-ILS/src/sql/Pg/002.schema.config.sql @@ -59,7 +59,7 @@ CREATE TABLE config.upgrade_log ( install_date TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW() ); -INSERT INTO config.upgrade_log (version) VALUES ('0209'); -- miker +INSERT INTO config.upgrade_log (version) VALUES ('0210'); -- Scott McKellar CREATE TABLE config.bib_source ( id SERIAL PRIMARY KEY, diff --git a/Open-ILS/src/sql/Pg/200.schema.acq.sql b/Open-ILS/src/sql/Pg/200.schema.acq.sql index a82b4a487c..13cc0196c8 100644 --- a/Open-ILS/src/sql/Pg/200.schema.acq.sql +++ b/Open-ILS/src/sql/Pg/200.schema.acq.sql @@ -2499,4 +2499,24 @@ CREATE TABLE acq.claim_event ( CREATE INDEX claim_event_claim_date_idx ON acq.claim_event( claim, event_date ); +CREATE TABLE acq.claim_policy ( + id SERIAL PRIMARY KEY, + org_unit INT NOT NULL REFERENCES actor.org_unit + DEFERRABLE INITIALLY DEFERRED, + name TEXT NOT NULL, + description TEXT NOT NULL, + CONSTRAINT name_once_per_org UNIQUE (org_unit, name) +); + +CREATE TABLE acq.claim_policy_action ( + id SERIAL PRIMARY KEY, + claim_policy INT NOT NULL REFERENCES acq.claim_policy + ON DELETE CASCADE + DEFERRABLE INITIALLY DEFERRED, + action_interval INTERVAL NOT NULL, + action INT NOT NULL REFERENCES acq.claim_event_type + DEFERRABLE INITIALLY DEFERRED, + CONSTRAINT action_sequence UNIQUE (claim_policy, action_interval) +); + COMMIT; diff --git a/Open-ILS/src/sql/Pg/upgrade/0210.schema.acq.claim-policy.sql b/Open-ILS/src/sql/Pg/upgrade/0210.schema.acq.claim-policy.sql new file mode 100644 index 0000000000..fc3dcfda81 --- /dev/null +++ b/Open-ILS/src/sql/Pg/upgrade/0210.schema.acq.claim-policy.sql @@ -0,0 +1,25 @@ +BEGIN; + +INSERT INTO config.upgrade_log (version) VALUES ('0210'); -- Scott McKellar + +CREATE TABLE acq.claim_policy ( + id SERIAL PRIMARY KEY, + org_unit INT NOT NULL REFERENCES actor.org_unit + DEFERRABLE INITIALLY DEFERRED, + name TEXT NOT NULL, + description TEXT NOT NULL, + CONSTRAINT name_once_per_org UNIQUE (org_unit, name) +); + +CREATE TABLE acq.claim_policy_action ( + id SERIAL PRIMARY KEY, + claim_policy INT NOT NULL REFERENCES acq.claim_policy + ON DELETE CASCADE + DEFERRABLE INITIALLY DEFERRED, + action_interval INTERVAL NOT NULL, + action INT NOT NULL REFERENCES acq.claim_event_type + DEFERRABLE INITIALLY DEFERRED, + CONSTRAINT action_sequence UNIQUE (claim_policy, action_interval) +); + +COMMIT;