moving debits to fund, not funding_source
authormiker <miker@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Wed, 6 Feb 2008 02:28:41 +0000 (02:28 +0000)
committermiker <miker@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Wed, 6 Feb 2008 02:28:41 +0000 (02:28 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/branches/acq-experiment@8650 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/src/sql/Pg/200.schema.acq.sql

index a427262..88f1127 100644 (file)
@@ -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,