From: miker Date: Wed, 6 Feb 2008 02:28:41 +0000 (+0000) Subject: moving debits to fund, not funding_source X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=166c89fc8f44342ad95809799e531c7842b06966;p=Evergreen.git moving debits to fund, not funding_source git-svn-id: svn://svn.open-ils.org/ILS/branches/acq-experiment@8650 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- diff --git a/Open-ILS/src/sql/Pg/200.schema.acq.sql b/Open-ILS/src/sql/Pg/200.schema.acq.sql index a427262724..88f11273e1 100644 --- a/Open-ILS/src/sql/Pg/200.schema.acq.sql +++ b/Open-ILS/src/sql/Pg/200.schema.acq.sql @@ -11,7 +11,7 @@ CREATE TABLE acq.currency_type ( -- Use the ISO 4217 abbreviations for currency codes INSERT INTO acq.currency_type (code, label) VALUES ('USD','US Dollars'); -INSERT INTO acq.currency_type (code, label) VALUES ('CAD','Canadian Dollars'); +INSERT INTO acq.currency_type (code, label) VALUES ('CAN','Canadian Dollars'); INSERT INTO acq.currency_type (code, label) VALUES ('EUR','Euros'); CREATE TABLE acq.exchange_rate ( @@ -33,13 +33,6 @@ CREATE TABLE acq.provider ( CONSTRAINT provider_name_once_per_owner UNIQUE (name,owner) ); -CREATE TABLE acq.provider_share_map ( - id SERIAL PRIMARY KEY, - provider INT NOT NULL REFERENCES acq.provider (id), - org INT NOT NULL REFERENCES actor.org_unit (id), - CONSTRAINT provider_share_once_per_owner UNIQUE (provider,org) -); - CREATE TABLE acq.funding_source ( id SERIAL PRIMARY KEY, name TEXT NOT NULL, @@ -48,13 +41,6 @@ CREATE TABLE acq.funding_source ( CONSTRAINT funding_source_name_once_per_owner UNIQUE (name,owner) ); -CREATE TABLE acq.funding_source_share_map ( - id SERIAL PRIMARY KEY, - funding_source INT NOT NULL REFERENCES acq.funding_source (id), - org INT NOT NULL REFERENCES actor.org_unit (id), - CONSTRAINT funding_source_share_once_per_owner UNIQUE (funding_source,org) -); - CREATE TABLE acq.funding_source_credit ( id SERIAL PRIMARY KEY, funding_source INT NOT NULL REFERENCES acq.funding_source (id), @@ -62,15 +48,6 @@ CREATE TABLE acq.funding_source_credit ( note TEXT ); -CREATE TABLE acq.funding_source_debit ( - id SERIAL PRIMARY KEY, - funding_source INT NOT NULL REFERENCES acq.funding_source (id), - origin_amount NUMERIC NOT NULL, -- pre-exchange-rate amount - origin_currency_type TEXT NOT NULL REFERENCES acq.currency_type (code), - amount NUMERIC NOT NULL, - encumberance BOOL NOT NULL DEFAULT TRUE -); - CREATE TABLE acq.picklist ( id SERIAL PRIMARY KEY, owner INT NOT NULL REFERENCES actor.usr (id), @@ -216,6 +193,15 @@ CREATE TABLE acq.fund ( CONSTRAINT name_once_per_org_year UNIQUE (org,name,year) ); +CREATE TABLE acq.fund_debit ( + id SERIAL PRIMARY KEY, + fund INT NOT NULL REFERENCES acq.fund (id), + origin_amount NUMERIC NOT NULL, -- pre-exchange-rate amount + origin_currency_type TEXT NOT NULL REFERENCES acq.currency_type (code), + amount NUMERIC NOT NULL, + encumberance BOOL NOT NULL DEFAULT TRUE +); + CREATE TABLE acq.fund_allocation ( id SERIAL PRIMARY KEY, funding_source INT NOT NULL REFERENCES acq.funding_source (id) ON UPDATE CASCADE ON DELETE CASCADE,