-- ABS-81878/ ABS-99317

---------- DELIVERYVARIATIONS ----------
ALTER TABLE DELIVERYVARIATIONS MODIFY (REFERENCE VARCHAR2(30));

---------- PRODUCTCABINETSERVICE -------------
CREATE TABLE PRODUCTCABINETSERVICE
(
  PRODUCT_ID     NUMBER NOT NULL,
  TYPE           NUMBER(1) DEFAULT 1 NOT NULL 
                 CONSTRAINT CHK_PRODUCTCABINETSERVICE_TY CHECK (TYPE IN (1, 2)),
  PRODUCTBARCODE VARCHAR2(30) NULL,
  SYSTEMUSER_ID  NUMBER NOT NULL,
  TIMESTAMP      DATE NOT NULL
)
;

COMMENT ON COLUMN PRODUCTCABINETSERVICE.TYPE
  IS '1 = Cabinet
2 = Cabinet content
';

ALTER TABLE PRODUCTCABINETSERVICE
  ADD CONSTRAINT XPKPRODUCTCABINETSERVICE PRIMARY KEY (PRODUCT_ID);

ALTER TABLE PRODUCTCABINETSERVICE
  ADD CONSTRAINT FK_PRODUCTCABINETSERVICE_PROD FOREIGN KEY (PRODUCT_ID)
  REFERENCES PRODUCT (PRODUCT_ID) ON DELETE CASCADE;

-- PLPCEXTRAINFO TABLE -- 
ALTER TABLE PLPCEXTRAINFO ADD (SERVICEBILLING VARCHAR2(1) DEFAULT 'N' NOT NULL
                               CONSTRAINT CHK_PLPCEXTRAINFO_SERVBILL CHECK (SERVICEBILLING IN ('Y', 'N')));

COMMENT ON COLUMN PLPCEXTRAINFO.SERVICEBILLING
  IS 'Y / N (BM1) used for module CABINETSERVICE only';