--ABS-73971/ABS-78725

---------------- PACKINGNOTELINEDELIVINV ----------------

CREATE TABLE PACKINGNOTELINEDELIVINV (PACKINGNOTELINE_ID NUMBER NOT NULL,
                                      INVOICEHEADER_ID NUMBER NOT NULL,      
                                      SYSTEMUSER_ID NUMBER NOT NULL, 
                                      TIMESTAMP DATE NOT NULL
                                      );
                                      
ALTER TABLE PACKINGNOTELINEDELIVINV ADD CONSTRAINT XPKPACKINGNOTELINEDELIVINV PRIMARY KEY(PACKINGNOTELINE_ID);
                                                                                 
CREATE INDEX XIF1PACKINGNOTELINEDELIVINV ON PACKINGNOTELINEDELIVINV(INVOICEHEADER_ID ASC);

ALTER TABLE PACKINGNOTELINEDELIVINV ADD CONSTRAINT PACKINGNOTELINEDELIVINV_PNL
FOREIGN KEY(PACKINGNOTELINE_ID)
REFERENCES PACKINGNOTELINE(PACKINGNOTELINE_ID) ON DELETE CASCADE;

ALTER TABLE PACKINGNOTELINEDELIVINV ADD CONSTRAINT PNLDELIVINV_INVOICEHEADER
FOREIGN KEY(INVOICEHEADER_ID)
REFERENCES INVOICEHEADER(INVOICEHEADER_ID) ON DELETE CASCADE;
               