-- ABS-31824
------------------   PLPCINSURANCEPRICE   --------------------
CREATE SEQUENCE SEQ_PLPCINSURANCEPRICE
START WITH 1
INCREMENT BY 1;

CREATE TABLE PLPCINSURANCEPRICE
(
PLPCINSURANCEPRICE_ID NUMBER NOT NULL,
PRODUCTLISTPERCUSTOMER_ID NUMBER NOT NULL,
STARTDATE DATE NOT NULL,
PRICE NUMBER(15,6) NOT NULL,
SYSTEMUSER_ID NUMBER NOT NULL,
TIMESTAMP DATE NOT NULL,
RATIFICATIONSTARTDATE DATE NULL,
CREATIONUSER_ID NUMBER NOT NULL,
CREATIONTIMESTAMP DATE NOT NULL,
RATIFICATIONUSER_ID NUMBER NULL,
RATIFICATIONTIMESTAMP DATE NULL
);

ALTER TABLE PLPCINSURANCEPRICE ADD CONSTRAINT XPKPLPCINSURANCEPRICE PRIMARY KEY
(PLPCINSURANCEPRICE_ID);

CREATE UNIQUE INDEX XAK1PLPCINSURANCEPRICE ON PLPCINSURANCEPRICE 
(PRODUCTLISTPERCUSTOMER_ID ASC, STARTDATE ASC);

CREATE INDEX XIF1PLPCINSURANCEPRICE ON PLPCINSURANCEPRICE 
(PRODUCTLISTPERCUSTOMER_ID ASC);

ALTER TABLE PLPCINSURANCEPRICE ADD CONSTRAINT PLPCINSURANCEPRICE_PLPCID FOREIGN KEY
(PRODUCTLISTPERCUSTOMER_ID) REFERENCES PRODUCTLISTPERCUSTOMER (PRODUCTLISTPERCUSTOMER_ID)
ON DELETE CASCADE;

