[open-ils-commits] r16423 - in trunk/Open-ILS: examples src/sql/Pg src/sql/Pg/upgrade (scottmk)

svn at svn.open-ils.org svn at svn.open-ils.org
Wed May 12 16:44:46 EDT 2010


Author: scottmk
Date: 2010-05-12 16:44:40 -0400 (Wed, 12 May 2010)
New Revision: 16423

Added:
   trunk/Open-ILS/src/sql/Pg/upgrade/0259.schema.acq-edi-msg-po.sql
Modified:
   trunk/Open-ILS/examples/fm_IDL.xml
   trunk/Open-ILS/src/sql/Pg/002.schema.config.sql
   trunk/Open-ILS/src/sql/Pg/200.schema.acq.sql
Log:
Add purchase_order column to acq.edi_message.

Also: add the CREATE TABLE command for acq.edi_message (including
the new column) to 200.schema.acq.sql, where it was omitted due
to an oversight.

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/0259.schema.acq-edi-msg-po.sql
M    Open-ILS/examples/fm_IDL.xml


Modified: trunk/Open-ILS/examples/fm_IDL.xml
===================================================================
--- trunk/Open-ILS/examples/fm_IDL.xml	2010-05-12 19:20:05 UTC (rev 16422)
+++ trunk/Open-ILS/examples/fm_IDL.xml	2010-05-12 20:44:40 UTC (rev 16423)
@@ -5848,9 +5848,11 @@
 			<field name="edi"              reporter:datatype="text"      reporter:label="EDI Message Body"/>
 			<field name="jedi"             reporter:datatype="text"      reporter:label="JEDI Message Body"/>
 			<field name="error"            reporter:datatype="text"      reporter:label="Error"/>
+			<field name="purchase_order"   reporter:datatype="link"      reporter:label="Purchase Order"/>
 		</fields>
 		<links>
 			<link field="account" reltype="has_a" key="id" map="" class="acqedi"/>
+			<link field="purchase_order" reltype="has_a" key="id" map="" class="acqpo"/>
 		</links>
         <permacrud xmlns="http://open-ils.org/spec/opensrf/IDL/permacrud/v1">
             <actions>

Modified: trunk/Open-ILS/src/sql/Pg/002.schema.config.sql
===================================================================
--- trunk/Open-ILS/src/sql/Pg/002.schema.config.sql	2010-05-12 19:20:05 UTC (rev 16422)
+++ trunk/Open-ILS/src/sql/Pg/002.schema.config.sql	2010-05-12 20:44:40 UTC (rev 16423)
@@ -65,7 +65,7 @@
     install_date    TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW()
 );
 
-INSERT INTO config.upgrade_log (version) VALUES ('0258'); -- Galen Charlton
+INSERT INTO config.upgrade_log (version) VALUES ('0259'); -- 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	2010-05-12 19:20:05 UTC (rev 16422)
+++ trunk/Open-ILS/src/sql/Pg/200.schema.acq.sql	2010-05-12 20:44:40 UTC (rev 16423)
@@ -760,6 +760,33 @@
 -- We need a UNIQUE constraint here also, to support the FK from acq.provider.edi_default
 ALTER TABLE acq.edi_account ADD CONSTRAINT acq_edi_account_id_unique UNIQUE (id);
 
+CREATE TABLE acq.edi_message (
+    id               SERIAL          PRIMARY KEY,
+    account          INTEGER         REFERENCES acq.edi_account(id)
+                                     DEFERRABLE INITIALLY DEFERRED,
+    remote_file      TEXT,
+    create_time      TIMESTAMPTZ     NOT NULL DEFAULT now(),
+    translate_time   TIMESTAMPTZ,
+    process_time     TIMESTAMPTZ,
+    error_time       TIMESTAMPTZ,
+    status           TEXT            NOT NULL DEFAULT 'new'
+                                     CONSTRAINT status_value CHECK
+                                     ( status IN (
+                                        'new',          -- needs to be translated
+                                        'translated',   -- needs to be processed
+                                        'trans_error',  -- error in translation step
+                                        'processed',    -- needs to have remote_file deleted
+                                        'proc_error',   -- error in processing step
+                                        'delete_error', -- error in deletion
+                                        'complete'      -- done
+                                     )),
+    edi              TEXT,
+    jedi             TEXT,
+    error            TEXT,
+    purchase_order   INT             REFERENCES acq.purchase_order
+                                     DEFERRABLE INITIALLY DEFERRED;
+);
+
 -- Note below that the primary key is NOT a SERIAL type.  We will periodically truncate and rebuild
 -- the table, assigning ids programmatically instead of using a sequence.
 CREATE TABLE acq.debit_attribution (

Added: trunk/Open-ILS/src/sql/Pg/upgrade/0259.schema.acq-edi-msg-po.sql
===================================================================
--- trunk/Open-ILS/src/sql/Pg/upgrade/0259.schema.acq-edi-msg-po.sql	                        (rev 0)
+++ trunk/Open-ILS/src/sql/Pg/upgrade/0259.schema.acq-edi-msg-po.sql	2010-05-12 20:44:40 UTC (rev 16423)
@@ -0,0 +1,21 @@
+BEGIN;
+
+INSERT INTO config.upgrade_log (version) VALUES ('0259'); -- Scott McKellar
+
+-- Warning: Due to an oversight, the acq.edi_message table was added via an
+-- upgrade script, but the CREATE TABLE statement was never added to the
+-- 200.schema.acq.sql script (till now).
+
+-- If you have rebuilt your system from scratch since then, you may find that
+-- the following ALTER will fail because the table doesn't exist yet.
+
+-- Solution: run the relevant CREATE TABLE statement from 200.schema.acq.sql
+-- instead of this upgrade script.  You may also want to manually insert a
+-- row into config.upgrade_log, as per the above.
+
+ALTER TABLE acq.edi_message
+    ADD COLUMN purchase_order INT
+	REFERENCES acq.purchase_order
+	DEFERRABLE INITIALLY DEFERRED;
+
+COMMIT;



More information about the open-ils-commits mailing list