LP1952931 Copy upgrade SQL to base schema
authorBill Erickson <berickxx@gmail.com>
Thu, 3 Feb 2022 16:54:09 +0000 (11:54 -0500)
committerBill Erickson <berickxx@gmail.com>
Fri, 11 Mar 2022 17:04:29 +0000 (12:04 -0500)
Signed-off-by: Bill Erickson <berickxx@gmail.com>
Open-ILS/src/sql/Pg/200.schema.acq.sql

index bb6b740..3195fee 100644 (file)
@@ -2630,4 +2630,31 @@ CREATE VIEW acq.po_state_label AS
           ('cancelled', oils_i18n_gettext('cancelled', 'Cancelled', 'acqpostlbl', 'label'))
        ) AS t (id,label);
 
+CREATE TABLE acq.shipment_notification (
+    id              SERIAL      PRIMARY KEY,
+    receiver        INT         NOT NULL REFERENCES actor.org_unit (id),
+    provider        INT         NOT NULL REFERENCES acq.provider (id),
+    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,
+    CONSTRAINT      container_code_once_per_provider UNIQUE(provider, container_code)
+);
+
+CREATE INDEX acq_asn_container_code_idx ON acq.shipment_notification (container_code);
+
+CREATE TABLE acq.shipment_notification_entry (
+    id                      SERIAL  PRIMARY KEY,
+    shipment_notification   INT NOT NULL REFERENCES acq.shipment_notification (id)
+                            ON DELETE CASCADE,
+    lineitem                INT REFERENCES acq.lineitem (id)
+                            ON UPDATE CASCADE ON DELETE SET NULL,
+    item_count              INT NOT NULL -- How many items the provider shipped
+);
+
+
 COMMIT;