

--
--    Licensed Materials - Property of IBM
--    
--    BI and PM: JSM
--    
--    (c) Copyright IBM Corp. 2003, 2010.
--    
--    US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
--    


-------------------------------------------------------------------------------
-- NC313_UPDATE_ORA.SQL	       *DO NOT EDIT*		Data Store Version: 313		 
-------------------------------------------------------------------------------

-------------------------------------------------------------------------------
--$100-- backup create begin
-------------------------------------------------------------------------------

-------------------------------------------------------------------------------
--$110-- backup inserts begin
-------------------------------------------------------------------------------

-------------------------------------------------------------------------------
--$130-- views drop begin
-------------------------------------------------------------------------------

-------------------------------------------------------------------------------
--$140-- tables drop begin
-------------------------------------------------------------------------------

-------------------------------------------------------------------------------
--$200-- recreate tables begin
-------------------------------------------------------------------------------

-------------------------------------------------------------------------------
--$202-- primary keys add begin
-------------------------------------------------------------------------------

-------------------------------------------------------------------------------
--$203-- alter tables begin
-------------------------------------------------------------------------------

ALTER TABLE NC_TASK_HISTORY_DETAIL DROP CONSTRAINT PN_TASK_HD;

ALTER TABLE NC_TASK_HISTORY_DETAIL MODIFY (TASK_ID CHAR(45));

ALTER TABLE NC_TASK_HISTORY_DETAIL ADD CONSTRAINT PN_TASK_HD PRIMARY KEY (TASK_ID,SUB_INDEX);

ALTER TABLE NC_TSE_STATE_MAP DROP CONSTRAINT PN_TSE_STATE_MAP;

ALTER TABLE NC_TSE_STATE_MAP MODIFY (TASK_ID CHAR(45));

ALTER TABLE NC_TSE_STATE_MAP ADD CONSTRAINT PN_TSE_STATE_MAP PRIMARY KEY (TASK_ID);

DROP INDEX IX_NC_TSE_STATE_MAP;

ALTER TABLE NC_TSE_STATE_MAP MODIFY (PARENT_ID  CHAR(45));

CREATE INDEX IX_NC_TSE_STATE_MAP ON NC_TSE_STATE_MAP (PARENT_ID, SEQ);

ALTER TABLE NC_TASK_QUEUE DROP CONSTRAINT PN_TASK_QUEUE;

ALTER TABLE NC_TASK_QUEUE MODIFY (TASK_ID  CHAR(45));

ALTER TABLE NC_TASK_QUEUE MODIFY (RESTART_ID CHAR(45));

ALTER TABLE NC_TASK_QUEUE ADD CONSTRAINT PN_TASK_QUEUE PRIMARY KEY (TASK_ID);

-- FOR THE TEMPORARY TABLE JUST DROP IT AND RECREATE WITH THE NEW VALUE AS THERE IS NO DATA TO MAINTAIN
DROP TABLE NC_TMP_PAGING;

CREATE GLOBAL TEMPORARY TABLE NC_TMP_PAGING (
    STOREID CHAR(45),
    SEVERITY INTEGER
) ON COMMIT PRESERVE ROWS;

ALTER TABLE NC_TASK_PROPERTY DROP CONSTRAINT PN_TASK_PROPERTY;

ALTER TABLE NC_TASK_PROPERTY MODIFY (TASK_ID CHAR(45));

ALTER TABLE NC_TASK_PROPERTY MODIFY (PROP_NAME CHAR(45)); 

ALTER TABLE NC_TASK_PROPERTY ADD CONSTRAINT PN_TASK_PROPERTY PRIMARY KEY (TASK_ID, PROP_NAME);

-------------------------------------------------------------------------------
--$210-- views create begin
-------------------------------------------------------------------------------

-------------------------------------------------------------------------------
--$220-- server data inserts begin
-------------------------------------------------------------------------------

INSERT INTO NC_DB_VERSION (DB_VERSION_ID,BUILD) VALUES(313,'build no.');


 -------------------------------------------------------------------------------
 --$230-- restore inserts begin
 -------------------------------------------------------------------------------

 -------------------------------------------------------------------------------
 --$250-- backup drop begin
 -------------------------------------------------------------------------------

-------------------------------------------------------------------------------
--$260-- end sql by function
-------------------------------------------------------------------------------
--	END NC313_UPDATE_ORA.SQL			*	DO NOT EDIT	 * 		 
-------------------------------------------------------------------------------
