-- ABS-36168

-------------------------CONTRACTPRODUCTBILLING------------------------------------
COMMENT ON COLUMN CONTRACTPRODUCTBILLING.MINIMUMFREQUENCY
  IS '1 = Every week 2 = Every delivery 3 = Every month (BM2) 4 = Every delivery Qty > 0 5 = Delivery Scheme based ';

--------------------------CONTRACTPRODUCT-------------------------------------------

ALTER TABLE CONTRACTPRODUCT DROP COLUMN PRODUCT_LINK_ID CASCADE CONSTRAINTS;
ALTER TABLE CONTRACTPRODUCT DROP COLUMN SIZEDEFINITION_LINK_ID CASCADE CONSTRAINTS;
ALTER TABLE CONTRACTPRODUCT ADD (PRODUCT_ID NUMBER NOT NULL, 
				 SIZEDEFINITION_ID NUMBER NOT NULL);


CREATE INDEX XIF3CONTRACTPRODUCT ON CONTRACTPRODUCT (PRODUCT_ID ASC);

CREATE INDEX XIF4CONTRACTPRODUCT ON CONTRACTPRODUCT (SIZEDEFINITION_ID ASC);

ALTER TABLE CONTRACTPRODUCT
  ADD CONSTRAINT CONTRACTPRODUCT_PROD FOREIGN KEY (PRODUCT_ID)
  REFERENCES PRODUCT (PRODUCT_ID);
ALTER TABLE CONTRACTPRODUCT
  ADD CONSTRAINT CONTRACTPRODUCT_SIZEDEF FOREIGN KEY (SIZEDEFINITION_ID)
  REFERENCES SIZEDEFINITION (SIZEDEFINITION_ID);
