--    IBM Confidential
--    
--    OCO Source Materials
--    
--    BI and PM: JSM
--    
--    (c) Copyright IBM Corp. 2013
--    
--    The source code for this program is not published or otherwise divested of its trade secrets, irrespective of what has been deposited with the U.S. Copyright Office.
--

-------------------------------------------------------------------------------
-- NC903_UPDATE_MS.SQL	       *DO NOT EDIT*		Data Store Version: 903	 
-------------------------------------------------------------------------------

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

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

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

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

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

-------------------------------------------------------------------------------
--$201-- indices create begin
-------------------------------------------------------------------------------

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

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

ALTER TABLE NC_TASK_ANCESTOR_STOREIDS
   DROP CONSTRAINT PK_ANCESTOR_IDS 
go
ALTER TABLE NC_TASK_ANCESTOR_STOREIDS 
	ALTER COLUMN TASK_ID  NCHAR (45) NOT NULL
go
ALTER TABLE NC_TASK_ANCESTOR_STOREIDS
   ADD CONSTRAINT PK_ANCESTOR_IDS PRIMARY KEY (TASK_ID, ANCESTOR_STORE_ID)
go
	

DROP INDEX NC_TASK_HISTORY_DETAIL.I_NC_TASK_HISTORY_DETAIL
go

ALTER TABLE NC_TASK_HISTORY_DETAIL 
	DROP CONSTRAINT PN_TASK_HD 
go
ALTER TABLE NC_TASK_HISTORY_DETAIL 
	ALTER COLUMN TASK_ID  NCHAR (45) NOT NULL
go
ALTER TABLE NC_TASK_HISTORY_DETAIL 
	ADD CONSTRAINT PN_TASK_HD PRIMARY KEY (TASK_ID,SUB_INDEX)
go

CREATE NONCLUSTERED INDEX I_NC_TASK_HISTORY_DETAIL ON NC_TASK_HISTORY_DETAIL(TASK_ID ASC) 
go


ALTER TABLE NC_TASK_PROPERTY 
	DROP CONSTRAINT PN_TASK_PROPERTY
go
ALTER TABLE NC_TASK_PROPERTY 
	ALTER COLUMN TASK_ID  NCHAR (45) NOT NULL
go
ALTER TABLE NC_TASK_PROPERTY 
	ADD CONSTRAINT PN_TASK_PROPERTY PRIMARY KEY (TASK_ID,PROP_NAME)
go

DROP INDEX NC_TASK_QUEUE.XII_NC_TASK_QUEUE
go
DROP INDEX NC_TASK_QUEUE.X_NC_TASK_QUEUE
go
ALTER TABLE NC_TASK_QUEUE 
	DROP CONSTRAINT PN_TASK_QUEUE
go
ALTER TABLE NC_TASK_QUEUE 
	ALTER COLUMN TASK_ID  NCHAR (45) NOT NULL
go
ALTER TABLE NC_TASK_QUEUE 
	ADD CONSTRAINT PN_TASK_QUEUE PRIMARY KEY (TASK_ID)
go
CREATE NONCLUSTERED INDEX X_NC_TASK_QUEUE ON NC_TASK_QUEUE(TASK_ID ASC)
go
CREATE NONCLUSTERED INDEX XII_NC_TASK_QUEUE ON NC_TASK_QUEUE (TASK_ID ASC, DATE_ENTERED ASC)
go


ALTER TABLE NC_TSE_STATE_MAP 
	DROP CONSTRAINT PN_TSE_STATE_MAP 
go
ALTER TABLE NC_TSE_STATE_MAP 
	ALTER COLUMN TASK_ID  NCHAR (45) NOT NULL
go
ALTER TABLE NC_TSE_STATE_MAP 
	ADD CONSTRAINT PN_TSE_STATE_MAP PRIMARY KEY (TASK_ID)
go


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

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

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

INSERT INTO NC_DB_VERSION (DB_VERSION_ID,BUILD) VALUES(903, 'build no.')
go

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

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