--ABS-132468 14

CREATE SEQUENCE SEQ_PLANTPRODSETTINGSFLEXFIELD
START WITH 1
INCREMENT BY 1;

--PLANTPRODSETTINGSFLEXFIELD TABLE
CREATE TABLE PLANTPRODSETTINGSFLEXFIELD
(
  PLANTPRODSETTINGSFLEXFIELD_ID NUMBER NOT NULL,
  PLANT_ID NUMBER NOT NULL,
  PRODUCT_ID NUMBER NOT NULL,
  SYSTEMUSER_ID NUMBER NOT NULL,
  TIMESTAMP DATE DEFAULT SYSDATE NOT NULL
);

ALTER TABLE PLANTPRODSETTINGSFLEXFIELD ADD CONSTRAINT XPKPLANTPRODSETTINGSFLEXFIELD PRIMARY KEY (PLANTPRODSETTINGSFLEXFIELD_ID);

CREATE INDEX XIF1PLANTPRODSETTINGSFLEXFIELD ON PLANTPRODSETTINGSFLEXFIELD (PLANT_ID);

CREATE INDEX XIF2PLANTPRODSETTINGSFLEXFIELD ON PLANTPRODSETTINGSFLEXFIELD (PRODUCT_ID);

ALTER TABLE PLANTPRODSETTINGSFLEXFIELD ADD CONSTRAINT FK_PLANTPRODSETTINGSFLEXFIELD_PLANT_ID FOREIGN KEY (PLANT_ID) REFERENCES PLANT (PLANT_ID) ON DELETE CASCADE;

ALTER TABLE PLANTPRODSETTINGSFLEXFIELD ADD CONSTRAINT FK_PLANTPRODSETTINGSFLEXFIELD_PRODUCT_ID FOREIGN KEY (PRODUCT_ID) REFERENCES PRODUCT (PRODUCT_ID) ON DELETE CASCADE;



