[open-ils-commits] r16441 - 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
Mon May 17 12:47:36 EDT 2010
Author: scottmk
Date: 2010-05-17 12:47:32 -0400 (Mon, 17 May 2010)
New Revision: 16441
Added:
trunk/Open-ILS/src/sql/Pg/upgrade/0264.schema.acq-edi-message-type.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:
Two changes to acq.edi_message:
1. New "message_type" column.
2. New valid value for status column: 'retry'.
-- WARNING: because the new column is NOT NULL, this upgrade script must
-- initialize it with something if the table is not empty. The initial
-- value, 'ORDERS', may not always be appropriate. Massage as needed.
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/0264.schema.acq-edi-message-type.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-16 21:01:28 UTC (rev 16440)
+++ trunk/Open-ILS/examples/fm_IDL.xml 2010-05-17 16:47:32 UTC (rev 16441)
@@ -5850,6 +5850,7 @@
<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"/>
+ <field name="message_type" reporter:datatype="text" reporter:label="Message Type"/>
</fields>
<links>
<link field="account" reltype="has_a" key="id" map="" class="acqedi"/>
Modified: trunk/Open-ILS/src/sql/Pg/002.schema.config.sql
===================================================================
--- trunk/Open-ILS/src/sql/Pg/002.schema.config.sql 2010-05-16 21:01:28 UTC (rev 16440)
+++ trunk/Open-ILS/src/sql/Pg/002.schema.config.sql 2010-05-17 16:47:32 UTC (rev 16441)
@@ -65,7 +65,7 @@
install_date TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW()
);
-INSERT INTO config.upgrade_log (version) VALUES ('0263'); -- miker
+INSERT INTO config.upgrade_log (version) VALUES ('0264'); -- 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-16 21:01:28 UTC (rev 16440)
+++ trunk/Open-ILS/src/sql/Pg/200.schema.acq.sql 2010-05-17 16:47:32 UTC (rev 16441)
@@ -778,13 +778,22 @@
'processed', -- needs to have remote_file deleted
'proc_error', -- error in processing step
'delete_error', -- error in deletion
+ 'retry', -- need to retry
'complete' -- done
)),
edi TEXT,
jedi TEXT,
error TEXT,
purchase_order INT REFERENCES acq.purchase_order
- DEFERRABLE INITIALLY DEFERRED
+ DEFERRABLE INITIALLY DEFERRED,
+ message_type TEXT NOT NULL CONSTRAINT valid_type CHECK
+ ( status IN (
+ 'ORDERS',
+ 'ORDRSP',
+ 'INVOIC',
+ 'OSTENQ',
+ 'OSTRPT'
+ ))
);
-- Note below that the primary key is NOT a SERIAL type. We will periodically truncate and rebuild
Added: trunk/Open-ILS/src/sql/Pg/upgrade/0264.schema.acq-edi-message-type.sql
===================================================================
--- trunk/Open-ILS/src/sql/Pg/upgrade/0264.schema.acq-edi-message-type.sql (rev 0)
+++ trunk/Open-ILS/src/sql/Pg/upgrade/0264.schema.acq-edi-message-type.sql 2010-05-17 16:47:32 UTC (rev 16441)
@@ -0,0 +1,48 @@
+BEGIN;
+
+INSERT INTO config.upgrade_log (version) VALUES ('0264'); -- Scott McKellar
+
+-- Add a message_type column
+
+-- WARNING: because the new column is NOT NULL, this upgrade script must
+-- initialize it with something if the table is not empty. The initial
+-- value, 'ORDERS', may not always be appropriate. Massage as needed.
+
+ALTER TABLE acq.edi_message
+ ADD COLUMN message_type TEXT;
+
+UPDATE acq.edi_message
+SET message_type = 'ORDERS';
+
+ALTER TABLE acq.edi_message
+ ALTER COLUMN message_type SET NOT NULL;
+
+ALTER TABLE acq.edi_message
+ ADD CONSTRAINT valid_message_type CHECK
+ ( message_type IN (
+ 'ORDERS',
+ 'ORDRSP',
+ 'INVOIC',
+ 'OSTENQ',
+ 'OSTRPT'
+ ));
+
+-- Add a new valid value for status: 'retry'
+
+ALTER TABLE acq.edi_message
+ DROP CONSTRAINT status_value;
+
+ALTER TABLE acq.edi_message
+ ADD 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
+ 'retry', -- need to retry
+ 'complete' -- done
+ ));
+
+COMMIT;
More information about the open-ils-commits
mailing list