--SO 20014385

CREATE TABLE LIGHTFRAMEPRODUCT
(
  DISTRIBUTIONPOINT_ID      NUMBER NOT NULL ,
  PAGENUMBER             NUMBER NOT NULL,
  LIGHTFRAMENUMBER       NUMBER NOT NULL,
  PRODUCT_ID NUMBER NOT NULL,
  SIZEDEFINITION_ID NUMBER NOT NULL,
  FINISHINGMETHOD_ID NUMBER NOT NULL,
  SYSTEMUSER_ID NUMBER NOT NULL,
  TIMESTAMP DATE NOT NULL
);

ALTER TABLE LIGHTFRAMEPRODUCT
ADD CONSTRAINT  XPKLIGHTFRAMEPRODUCT PRIMARY KEY (DISTRIBUTIONPOINT_ID,PAGENUMBER,LIGHTFRAMENUMBER);

CREATE INDEX XIF1LIGHTFRAMEPRODUCT ON LIGHTFRAMEPRODUCT
(DISTRIBUTIONPOINT_ID   ASC);

CREATE INDEX XIF2LIGHTFRAMEPRODUCT ON LIGHTFRAMEPRODUCT
(PRODUCT_ID   ASC);

CREATE INDEX XIF3LIGHTFRAMEPRODUCT ON LIGHTFRAMEPRODUCT
(SIZEDEFINITION_ID   ASC);

CREATE INDEX XIF4LIGHTFRAMEPRODUCT ON LIGHTFRAMEPRODUCT
(FINISHINGMETHOD_ID   ASC);

ALTER TABLE LIGHTFRAMEPRODUCT
ADD CONSTRAINT LIGHTFRAMEPRODUCT_DP FOREIGN KEY (DISTRIBUTIONPOINT_ID) REFERENCES DISTRIBUTIONPOINT (DISTRIBUTIONPOINT_ID);


ALTER TABLE LIGHTFRAMEPRODUCT
ADD CONSTRAINT LIGHTFRAMEPRODUCT_P FOREIGN KEY (PRODUCT_ID) REFERENCES PRODUCT (PRODUCT_ID);

ALTER TABLE LIGHTFRAMEPRODUCT
ADD CONSTRAINT LIGHTFRAMEPRODUCT_SD FOREIGN KEY (SIZEDEFINITION_ID) REFERENCES SIZEDEFINITION (SIZEDEFINITION_ID);

ALTER TABLE LIGHTFRAMEPRODUCT
ADD CONSTRAINT LIGHTFRAMEPRODUCT_FM FOREIGN KEY (FINISHINGMETHOD_ID) REFERENCES FINISHINGMETHOD (FINISHINGMETHOD_ID);

