/*ORDER 502328*/      
      /*
      CHANGE REPORT for Table CUSTOMERPREPCHARGE
          - Adding a new relationship CUSTOMERPREPCHARGE_REASONCODE_
          WARNING : Create FK statement may fail (existing data may violate the new FK rules: adding a new FK CUSTOMERPREPCHARGE_REASONCODE_ of table CUSTOMERPREPCHARGE, which references table REASONCODE).
          - Adding column REASONCODE_ID
          - Changing definition of index XAK1CUSTOMERPREPCHARGE
          - Adding index XIF2CUSTOMERPREPCHARGE
      ACTION is ALTER or modify Table CUSTOMERPREPCHARGE
      */

DROP INDEX XAK1CUSTOMERPREPCHARGE;


ALTER TABLE CUSTOMERPREPCHARGE ADD (REASONCODE_ID        NUMBER NULL);

CREATE UNIQUE INDEX XAK1CUSTOMERPREPCHARGE ON CUSTOMERPREPCHARGE
(
       CUSTOMER_ID                    ASC,
       REASONCODE_ID                  ASC,
       STARTDATE                      ASC
);

CREATE INDEX XIF2CUSTOMERPREPCHARGE ON CUSTOMERPREPCHARGE
(
       REASONCODE_ID                  ASC
);


ALTER TABLE CUSTOMERPREPCHARGE
       ADD  ( CONSTRAINT CUSTOMERPREPCHARGE_REASONCODE_
              FOREIGN KEY (REASONCODE_ID)
                             REFERENCES REASONCODE ) ;

