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

CREATE TABLE CMINDEXQUEUE (
	OBJID 	 		VARCHAR(1024) DEFAULT NULL,
	ITEMID	 		VARCHAR(50) NOT NULL,
	QUEUEID			VARCHAR(50) NOT NULL,
	WORKFLOW 		VARCHAR(50) NOT NULL,
	CONSUMERNAME	VARCHAR(50) DEFAULT NULL,
	STATE			INT,
	INSERTIONTIME 	TIMESTAMP NOT NULL,
	INDEXACTION		VARCHAR(50) NOT NULL,
	INDEXCLASS		VARCHAR(255) NOT NULL,
	INDEXPROPS		CLOB(10M),
	CONSTRAINT PK_CMINDEXQUEUE PRIMARY KEY (ITEMID)
)IN CMSCRIPT_CREATE_IN;

CREATE INDEX IDX_CMINDEXQUEUE ON CMINDEXQUEUE(STATE, QUEUEID) USING STOGROUP CMSCRIPT_STOGROUP;

CREATE  UNIQUE  INDEX PK_CMINDEXQUEUE ON CMINDEXQUEUE (ITEMID) USING STOGROUP CMSCRIPT_STOGROUP;

CREATE AUXILIARY TABLE CMATB116
   IN CMSCRIPT_DATABASE.CMSCRIPT_CS_IDCML116
   STORES CMINDEXQUEUE
   COLUMN INDEXPROPS;
   
CREATE  UNIQUE  INDEX CMIDX116 ON CMATB116 USING STOGROUP CMSCRIPT_STOGROUP; 

