--ABSN-7387

--CREDITCARDTRANSMESSAGE TABLE
CREATE TABLE CREDITCARDTRANSMESSAGE(
CREDITCARDTRANSACTION_ID NUMBER NOT NULL,
MESSAGE_ID               NUMBER NOT NULL,
SYSTEMUSER_ID            NUMBER NOT NULL,
TIMESTAMP                DATE   NOT NULL);

ALTER TABLE CREDITCARDTRANSMESSAGE ADD CONSTRAINT XPKCREDITCARDTRANSMESSAGE PRIMARY KEY (CREDITCARDTRANSACTION_ID, MESSAGE_ID);

CREATE INDEX XIF1CREDITCARDTRANSMESSAGE ON CREDITCARDTRANSMESSAGE (CREDITCARDTRANSACTION_ID ASC);
CREATE INDEX XIF2CREDITCARDTRANSMESSAGE ON CREDITCARDTRANSMESSAGE (MESSAGE_ID ASC);

ALTER TABLE CREDITCARDTRANSMESSAGE 
      ADD CONSTRAINT FK_CREDITCARDTRANSMESSAGE_CREDITCARDTRANS FOREIGN KEY (CREDITCARDTRANSACTION_ID) REFERENCES CREDITCARDTRANSACTION (CREDITCARDTRANSACTION_ID) ON DELETE CASCADE;

ALTER TABLE CREDITCARDTRANSMESSAGE 
      ADD CONSTRAINT FK_CREDITCARDTRANSMESSAGE_MESSAGE_ID FOREIGN KEY (MESSAGE_ID) REFERENCES MESSAGE (MESSAGE_ID) ON DELETE CASCADE;

