[open-ils-commits] r15167 - in trunk/Open-ILS/src/sql/Pg: . upgrade (scottmk)
svn at svn.open-ils.org
svn at svn.open-ils.org
Tue Dec 15 13:03:22 EST 2009
Author: scottmk
Date: 2009-12-15 13:03:18 -0500 (Tue, 15 Dec 2009)
New Revision: 15167
Added:
trunk/Open-ILS/src/sql/Pg/upgrade/0115.schema.aou-fy-foreign-key.sql
Modified:
trunk/Open-ILS/src/sql/Pg/002.schema.config.sql
trunk/Open-ILS/src/sql/Pg/200.schema.acq.sql
Log:
1. Create a default entry in acq.fiscal_calendar.
2. Create a foreign key in acq.actor.org_unit pointing
to acq.fiscal_calendar, and defaulting to 1.
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/0115.schema.aou-fy-foreign-key.sql
Modified: trunk/Open-ILS/src/sql/Pg/002.schema.config.sql
===================================================================
--- trunk/Open-ILS/src/sql/Pg/002.schema.config.sql 2009-12-15 13:54:51 UTC (rev 15166)
+++ trunk/Open-ILS/src/sql/Pg/002.schema.config.sql 2009-12-15 18:03:18 UTC (rev 15167)
@@ -51,7 +51,7 @@
install_date TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW()
);
-INSERT INTO config.upgrade_log (version) VALUES ('0114'); -- berick
+INSERT INTO config.upgrade_log (version) VALUES ('0115'); -- Scott McKellar
CREATE TABLE config.bib_source (
id SERIAL PRIMARY KEY,
Modified: trunk/Open-ILS/src/sql/Pg/200.schema.acq.sql
===================================================================
--- trunk/Open-ILS/src/sql/Pg/200.schema.acq.sql 2009-12-15 13:54:51 UTC (rev 15166)
+++ trunk/Open-ILS/src/sql/Pg/200.schema.acq.sql 2009-12-15 18:03:18 UTC (rev 15167)
@@ -417,6 +417,23 @@
name TEXT NOT NULL
);
+-- Create a default calendar (though we don't specify its contents).
+-- Create a foreign key in actor.org_unit, initially pointing to
+-- the default calendar.
+
+INSERT INTO acq.fiscal_calendar (
+ name
+) VALUES (
+
+ 'Default'
+);
+
+ALTER TABLE actor.org_unit
+ADD COLUMN fiscal_calendar INT NOT NULL
+ REFERENCES acq.fiscal_calendar( id )
+ DEFERRABLE INITIALLY DEFERRED
+ DEFAULT 1;
+
CREATE TABLE acq.fiscal_year (
id SERIAL PRIMARY KEY,
calendar INT NOT NULL
Added: trunk/Open-ILS/src/sql/Pg/upgrade/0115.schema.aou-fy-foreign-key.sql
===================================================================
--- trunk/Open-ILS/src/sql/Pg/upgrade/0115.schema.aou-fy-foreign-key.sql (rev 0)
+++ trunk/Open-ILS/src/sql/Pg/upgrade/0115.schema.aou-fy-foreign-key.sql 2009-12-15 18:03:18 UTC (rev 15167)
@@ -0,0 +1,21 @@
+-- Create a default row in acq.fiscal_calendar
+-- Add a column in actor.org_unit to point to it
+
+BEGIN;
+
+INSERT INTO config.upgrade_log (version) VALUES ('0115'); -- Scott McKellar
+
+INSERT INTO acq.fiscal_calendar (
+ name
+) VALUES (
+
+ 'Default'
+);
+
+ALTER TABLE actor.org_unit
+ADD COLUMN fiscal_calendar INT NOT NULL
+ REFERENCES acq.fiscal_calendar( id )
+ DEFERRABLE INITIALLY DEFERRED
+ DEFAULT 1;
+
+COMMIT;
More information about the open-ils-commits
mailing list