From: scottmk Date: Mon, 11 Jan 2010 16:55:39 +0000 (+0000) Subject: Add a boolean "propagate" column to acq.fund, to denote whether X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=50aa8efaacc5f68a88d911fa5c8e10ae68788fb2;p=contrib%2FConifer.git Add a boolean "propagate" column to acq.fund, to denote whether the fund should be propagated from one year to the next. 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/0132.schema.acq.fund-propagable.sql M Open-ILS/examples/fm_IDL.xml git-svn-id: svn://svn.open-ils.org/ILS/trunk@15298 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- diff --git a/Open-ILS/examples/fm_IDL.xml b/Open-ILS/examples/fm_IDL.xml index 21470d6c7e..9944aba88f 100644 --- a/Open-ILS/examples/fm_IDL.xml +++ b/Open-ILS/examples/fm_IDL.xml @@ -4581,6 +4581,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + diff --git a/Open-ILS/src/sql/Pg/002.schema.config.sql b/Open-ILS/src/sql/Pg/002.schema.config.sql index f6a11a5e6a..31341d049a 100644 --- a/Open-ILS/src/sql/Pg/002.schema.config.sql +++ b/Open-ILS/src/sql/Pg/002.schema.config.sql @@ -51,7 +51,7 @@ CREATE TABLE config.upgrade_log ( install_date TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW() ); -INSERT INTO config.upgrade_log (version) VALUES ('0131'); -- dbs +INSERT INTO config.upgrade_log (version) VALUES ('0132'); -- 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 54faee0b26..ed5029db62 100644 --- a/Open-ILS/src/sql/Pg/200.schema.acq.sql +++ b/Open-ILS/src/sql/Pg/200.schema.acq.sql @@ -169,8 +169,10 @@ CREATE TABLE acq.fund ( currency_type TEXT NOT NULL REFERENCES acq.currency_type (code) DEFERRABLE INITIALLY DEFERRED, code TEXT, rollover BOOL NOT NULL DEFAULT FALSE, + propagate BOOL NOT NULL DEFAULT TRUE, CONSTRAINT name_once_per_org_year UNIQUE (org,name,year), - CONSTRAINT code_once_per_org_year UNIQUE (org, code, year) + CONSTRAINT code_once_per_org_year UNIQUE (org, code, year), + CONSTRAINT acq_fund_rollover_implies_propagate CHECK ( propagate OR NOT rollover ) ); CREATE TABLE acq.fund_debit ( diff --git a/Open-ILS/src/sql/Pg/upgrade/0132.schema.acq.fund-propagable.sql b/Open-ILS/src/sql/Pg/upgrade/0132.schema.acq.fund-propagable.sql new file mode 100644 index 0000000000..0cb8e48f5d --- /dev/null +++ b/Open-ILS/src/sql/Pg/upgrade/0132.schema.acq.fund-propagable.sql @@ -0,0 +1,14 @@ +BEGIN; + +INSERT INTO config.upgrade_log (version) VALUES ('0132'); -- Scott McKellar + +ALTER TABLE acq.fund + ADD COLUMN propagate BOOLEAN NOT NULL DEFAULT TRUE; + +-- A fund can't roll over if it doesn't propagate from one year to the next + +ALTER TABLE acq.fund + ADD CONSTRAINT acq_fund_rollover_implies_propagate CHECK + ( propagate OR NOT rollover ); + +COMMIT;