

--
--    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.
--    


-------------------------------------------------------------------------------
-- NC12_UPDATE_ORA.SQL         *DO NOT EDIT*		Data Store Version: 12		 
-------------------------------------------------------------------------------

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

CREATE TABLE BC_NC_EVENTSTATUS(
   PK_EVENT_ID                   CHAR(45) NOT NULL,
   EVENT_STATUS                  INTEGER NOT NULL,
   CONVERSATION                  INTEGER
);

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

INSERT INTO BC_NC_EVENTSTATUS (
	PK_EVENT_ID, EVENT_STATUS, CONVERSATION) 
  SELECT PK_EVENT_ID, EVENT_STATUS, CONVERSATION
  FROM NC_EVENTSTATUS;

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


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

DROP TABLE NC_EVENTSTATUS;

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

CREATE TABLE NC_EVENTSTATUS(
   	PK_EVENT_ID                   	CHAR(45) 	NOT NULL,
   	EVENT_STATUS                  	INTEGER 	NOT NULL,
   	CONVERSATION                  	INTEGER,
   	SDS_INSTANCE_ID 		CHAR (32) 
);

CREATE TABLE NC_JOBQUEUE (
   	PK_RUN_ID 			CHAR (45) 	NOT NULL ,
   	DATE_ENTERED 			NUMBER 		NOT NULL ,
	JOB 				LONG RAW 	NOT NULL 
);

CREATE TABLE NC_SDS_INSTANCE (
	PK_INSTANCE_ID 			CHAR (32) 	NOT NULL ,
	PK_INSTANCE_URL 		VARCHAR2 (255) 	NOT NULL ,
	LAST_UPDATE 			NUMBER 		NOT NULL ,
	CLEANUP_INSTANCE_ID 		CHAR (32) 	NULL 
);

-------------------------------------------------------------------------------
--$202-- indexes & primary keys add begin
-------------------------------------------------------------------------------

ALTER TABLE NC_EVENTSTATUS
   ADD CONSTRAINT PN_NC_EVENTSTATUS PRIMARY KEY (PK_EVENT_ID);

ALTER TABLE NC_JOBQUEUE
	ADD CONSTRAINT PN_JOBQUEUE PRIMARY KEY (PK_RUN_ID);

ALTER TABLE NC_SDS_INSTANCE
	ADD CONSTRAINT PN_SDS_INSTANCE PRIMARY KEY (PK_INSTANCE_ID);

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

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

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

INSERT INTO NC_CONFIGURATION(PROPERTY_KEY,PROPERTY_VALUE) 
	VALUES ('job.queue.factory.class','com.cognos.js2.MemoryQueueFactory');

INSERT INTO NC_CONFIGURATION(PROPERTY_KEY,PROPERTY_VALUE) 
	VALUES ('job.queue.poll.interval.seconds','30');

INSERT INTO NC_CONFIGURATION(PROPERTY_KEY,PROPERTY_VALUE) 
	VALUES ('sds.instance.update.interval.seconds','30');
	   
-------------------------------------------------------------------------------
--$230-- restore inserts begin
-------------------------------------------------------------------------------

INSERT INTO NC_EVENTSTATUS (
	PK_EVENT_ID, EVENT_STATUS, CONVERSATION) 
  SELECT PK_EVENT_ID, EVENT_STATUS, CONVERSATION
  FROM BC_NC_EVENTSTATUS;

-------------------------------------------------------------------------------
--$240-- foreign keys add begin
-------------------------------------------------------------------------------
-------------------------------------------------------------------------------
--$250-- backup drop begin
-------------------------------------------------------------------------------

DROP TABLE BC_NC_EVENTSTATUS;

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