From 574840dd2756c3824e78dfa13510b8be6bc9b252 Mon Sep 17 00:00:00 2001 From: Bill Erickson Date: Thu, 3 Feb 2022 11:06:29 -0500 Subject: [PATCH] LP1952931 Add process date and processed by fields Signed-off-by: Bill Erickson --- Open-ILS/examples/fm_IDL.xml | 3 ++ .../src/sql/Pg/upgrade/XXXX.schema.acq-asn.sql | 37 ++++++++++++++++------ 2 files changed, 31 insertions(+), 9 deletions(-) diff --git a/Open-ILS/examples/fm_IDL.xml b/Open-ILS/examples/fm_IDL.xml index abdbcb1e8f..509567d160 100644 --- a/Open-ILS/examples/fm_IDL.xml +++ b/Open-ILS/examples/fm_IDL.xml @@ -9472,6 +9472,8 @@ SELECT usr, + + @@ -9479,6 +9481,7 @@ SELECT usr, reporter:datatype="link" oils_persist:virtual="true"/> + diff --git a/Open-ILS/src/sql/Pg/upgrade/XXXX.schema.acq-asn.sql b/Open-ILS/src/sql/Pg/upgrade/XXXX.schema.acq-asn.sql index 7b92e1b84b..ad295b721f 100644 --- a/Open-ILS/src/sql/Pg/upgrade/XXXX.schema.acq-asn.sql +++ b/Open-ILS/src/sql/Pg/upgrade/XXXX.schema.acq-asn.sql @@ -9,6 +9,8 @@ CREATE TABLE acq.shipment_notification ( shipper INT NOT NULL REFERENCES acq.provider (id), recv_date TIMESTAMPTZ NOT NULL DEFAULT NOW(), recv_method TEXT NOT NULL REFERENCES acq.invoice_method (code) DEFAULT 'EDI', + process_date TIMESTAMPTZ, + processed_by INT REFERENCES actor.usr(id) ON DELETE SET NULL, container_code TEXT NOT NULL, -- vendor-supplied super-barcode lading_number TEXT, -- informational note TEXT, @@ -19,9 +21,9 @@ CREATE INDEX acq_asn_container_code_idx ON acq.shipment_notification (container_ CREATE TABLE acq.shipment_notification_entry ( id SERIAL PRIMARY KEY, - shipment_notification INT NOT NULL REFERENCES acq.shipment_notification (id) + shipment_notification INT NOT NULL REFERENCES acq.shipment_notification (id) ON DELETE CASCADE, - lineitem INT REFERENCES acq.lineitem (id) + lineitem INT REFERENCES acq.lineitem (id) ON UPDATE CASCADE ON DELETE SET NULL, item_count INT NOT NULL -- How many items the provider shipped ); @@ -29,15 +31,15 @@ CREATE TABLE acq.shipment_notification_entry ( /* TODO alter valid_message_type constraint */ ALTER TABLE acq.edi_message DROP CONSTRAINT valid_message_type; -ALTER TABLE acq.edi_message ADD CONSTRAINT valid_message_type +ALTER TABLE acq.edi_message ADD CONSTRAINT valid_message_type CHECK ( message_type IN ( - 'ORDERS', - 'ORDRSP', - 'INVOIC', - 'OSTENQ', - 'OSTRPT', - 'DESADV' + 'ORDERS', + 'ORDRSP', + 'INVOIC', + 'OSTENQ', + 'OSTRPT', + 'DESADV' ) ); @@ -45,6 +47,23 @@ COMMIT; /* UNDO +DELETE FROM acq.edi_message WHERE message_type = 'DESADV'; + +DELETE FROM acq.shipment_notification_entry; +DELETE FROM acq.shipment_notification; + +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' + ) +); + DROP TABLE acq.shipment_notification_entry; DROP TABLE acq.shipment_notification; -- 2.11.0