From f27eb6abc2694d4e68f6118b56cfc3469fc46a8f Mon Sep 17 00:00:00 2001 From: phasefx Date: Mon, 29 Mar 2010 20:36:16 +0000 Subject: [PATCH] reorder these so that they work git-svn-id: svn://svn.open-ils.org/ILS/trunk@16046 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- Open-ILS/src/sql/Pg/200.schema.acq.sql | 60 +++++++++++++++++----------------- 1 file changed, 30 insertions(+), 30 deletions(-) diff --git a/Open-ILS/src/sql/Pg/200.schema.acq.sql b/Open-ILS/src/sql/Pg/200.schema.acq.sql index 504a9b6fc5..2950145955 100644 --- a/Open-ILS/src/sql/Pg/200.schema.acq.sql +++ b/Open-ILS/src/sql/Pg/200.schema.acq.sql @@ -29,6 +29,36 @@ CREATE TABLE acq.exchange_rate ( INSERT INTO acq.exchange_rate (from_currency,to_currency,ratio) VALUES ('USD','CAN',1.2); INSERT INTO acq.exchange_rate (from_currency,to_currency,ratio) VALUES ('USD','EUR',0.5); +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_event_type ( + id SERIAL PRIMARY KEY, + org_unit INT NOT NULL REFERENCES actor.org_unit(id) + DEFERRABLE INITIALLY DEFERRED, + code TEXT NOT NULL, + description TEXT NOT NULL, + library_initiated BOOL NOT NULL DEFAULT FALSE, + CONSTRAINT event_type_once_per_org UNIQUE ( org_unit, code ) +); + +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) +); + CREATE TABLE acq.provider ( id SERIAL PRIMARY KEY, name TEXT NOT NULL, @@ -2494,16 +2524,6 @@ CREATE TABLE acq.claim_type ( CONSTRAINT claim_type_once_per_org UNIQUE ( org_unit, code ) ); -CREATE TABLE acq.claim_event_type ( - id SERIAL PRIMARY KEY, - org_unit INT NOT NULL REFERENCES actor.org_unit(id) - DEFERRABLE INITIALLY DEFERRED, - code TEXT NOT NULL, - description TEXT NOT NULL, - library_initiated BOOL NOT NULL DEFAULT FALSE, - CONSTRAINT event_type_once_per_org UNIQUE ( org_unit, code ) -); - CREATE TABLE acq.claim ( id SERIAL PRIMARY KEY, type INT NOT NULL REFERENCES acq.claim_type @@ -2528,24 +2548,4 @@ 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; -- 2.11.0