--ABS-11734

----------------- PRODUCTLISTPERCUSTOMER ----------------- 
ALTER TABLE PRODUCTLISTPERCUSTOMER ADD (USECHIPPINGRATEDEE NUMBER DEFAULT 0 NOT NULL 
                                                           CONSTRAINT USECHIPPINGRATEDEE_VALID1_1
                                                           CHECK (USECHIPPINGRATEDEE IN (0,1)),
                                       USECHIPPINGRATEEXCHCART NUMBER DEFAULT 0 NOT NULL 
                                                               CONSTRAINT USECHIPPINGRATEECART_VALID1_1
                                                               CHECK (USECHIPPINGRATEEXCHCART IN (0,1)));

COMMENT ON COLUMN PRODUCTLISTPERCUSTOMER.USECHIPPINGRATEDEE
  IS '0 = Do not use Chipping Rate
1 = Use Chipping Rate';
COMMENT ON COLUMN PRODUCTLISTPERCUSTOMER.USECHIPPINGRATEEXCHCART
  IS '0 = Do not use Chipping Rate
1 = Use Chipping Rate';


----------------- UNIQUEITEMEXCHANGECART ----------------- 
CREATE TABLE UNIQUEITEMEXCHANGECART
(
  UNIQUEITEM_ID   NUMBER NOT NULL,
  EXCHANGECART_ID NUMBER NOT NULL,
  SYSTEMUSER_ID   NUMBER NOT NULL,
  TIMESTAMP       DATE NOT NULL
);

ALTER TABLE UNIQUEITEMEXCHANGECART
  ADD CONSTRAINT XPKUNIQUEITEMEXCHANGECART PRIMARY KEY (UNIQUEITEM_ID);
  
CREATE INDEX XIF1UNIQUEITEMEXCHANGECART ON UNIQUEITEMEXCHANGECART (EXCHANGECART_ID ASC);

ALTER TABLE UNIQUEITEMEXCHANGECART
  ADD CONSTRAINT UIEXCHANGECART_UNIQUEITEM FOREIGN KEY (UNIQUEITEM_ID)
  REFERENCES UNIQUEITEM (UNIQUEITEM_ID) ON DELETE CASCADE;
  
ALTER TABLE UNIQUEITEMEXCHANGECART
  ADD CONSTRAINT UIEXCHANGECART_EXCHANGECART FOREIGN KEY (EXCHANGECART_ID)
  REFERENCES EXCHANGECART (EXCHANGECART_ID) ON DELETE CASCADE;

----------------- PROCESS -----------------   
INSERT INTO PROCESS(PROCESS_ID,DESCRIPTION,ACTIVE) 
       VALUES ('141','Chipping Rate Standard','Y');
COMMIT;

INSERT INTO PROCESS(PROCESS_ID,DESCRIPTION,ACTIVE) 
       VALUES ('142','Chipping Rate Stock Level','Y');
COMMIT;
