correct, but this upgrade script will fix a database table that was built
from the installation script, which was wrong.
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/0266.schema.acq-fix-edi-message-check.sql
git-svn-id: svn://svn.open-ils.org/ILS/trunk@16449
dcc99617-32d9-48b4-a31d-
7c20da2025e4
install_date TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW()
);
-INSERT INTO config.upgrade_log (version) VALUES ('0264'); -- Scott McKellar
+INSERT INTO config.upgrade_log (version) VALUES ('0266'); -- Scott McKellar
CREATE TABLE config.bib_source (
id SERIAL PRIMARY KEY,
purchase_order INT REFERENCES acq.purchase_order
DEFERRABLE INITIALLY DEFERRED,
message_type TEXT NOT NULL CONSTRAINT valid_type CHECK
- ( status IN (
+ ( message_type IN (
'ORDERS',
'ORDRSP',
'INVOIC',
--- /dev/null
+BEGIN;
+
+-- Depending on how your edi_message table was created, one of the constraints
+-- may be wrong. The following will fix it if it's wrong, and have no effect
+-- if it's right.
+
+INSERT INTO config.upgrade_log (version) VALUES ('0266'); -- Scott McKellar
+
+ALTER TABLE acq.edi_message
+ DROP CONSTRAINT valid_message_type;
+
+ALTER TABLE acq.edi_message
+ ADD CONSTRAINT valid_message_type CHECK
+ ( message_type IN (
+ 'ORDERS',
+ 'ORDRSP',
+ 'INVOIC',
+ 'OSTENQ',
+ 'OSTRPT'
+ ));
+
+COMMIT;