--order 502745

ALTER TABLE PEAKUSERS DROP CONSTRAINT PEAKUSERS_APPLICATIONSERVER_ID;

DROP INDEX XAK1PEAKUSERS;

DROP INDEX XIF1PEAKUSERS;
      
      /*
      CHANGE REPORT for Table APPLICATIONSERVER
          - Adding column TIMESTAMP
      ACTION is ALTER or modify Table APPLICATIONSERVER
      */

ALTER TABLE APPLICATIONSERVER ADD (TIMESTAMP DATE   DEFAULT  SYSDATE  NOT NULL );

      /*
      CHANGE REPORT for Table PEAKUSERS
          - Changing definition of relation PEAKUSERS_APPLICATIONSERVER_ID
          - change null constraint from NOT NULL to NULL of column APPLICATIONSERVER_ID
      ACTION is ALTER or modify Table PEAKUSERS
      IMPACT ANALYSIS REPORT for ALTER or modify Table PEAKUSERS
          - index XAK1PEAKUSERS needs to be removed in order to proceed. 
          - index XIF1PEAKUSERS needs to be removed in order to proceed. 
      */

ALTER TABLE PEAKUSERS MODIFY (APPLICATIONSERVER_ID NULL);

CREATE UNIQUE INDEX XAK1PEAKUSERS ON PEAKUSERS
(
       APPLICATIONSERVER_ID           ASC,
       LOGINDATE                      ASC
);

CREATE INDEX XIF1PEAKUSERS ON PEAKUSERS
(
       APPLICATIONSERVER_ID           ASC
);

ALTER TABLE PEAKUSERS
       ADD  ( CONSTRAINT PEAKUSERS_APPLICATIONSERVER_ID
              FOREIGN KEY (APPLICATIONSERVER_ID)
                             REFERENCES APPLICATIONSERVER
                             ON DELETE CASCADE ) ;

