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

-- Copyright (C) 2008 Cognos ULC, an IBM Company. All rights reserved.
-- Cognos (R) is a trademark of Cognos ULC, (formerly Cognos Incorporated).


create table CMCRYPTOKEYS (
	CRYPTOKEY		varchar(255)	not null,
	CI_CRYPTOKEY	varchar(255)	not null,	
	DATA			blob(1G),
	constraint PK_CMCRYPTOKEYS primary key (CI_CRYPTOKEY)
) IN CMSCRIPT_CREATE_IN;

CREATE  UNIQUE  INDEX PK_CMCRYPTOKEYS ON CMCRYPTOKEYS (CI_CRYPTOKEY ASC ) USING STOGROUP CMSCRIPT_STOGROUP; 

CREATE AUXILIARY TABLE CMATB002
   IN CMSCRIPT_DATABASE.CMSCRIPT_CS_IDCML002
   STORES CMCRYPTOKEYS
   COLUMN DATA;

CREATE  UNIQUE  INDEX CMIDX002 ON CMATB002 USING STOGROUP CMSCRIPT_STOGROUP;
 
create table CMCAKEYS (
	CAKEY		varchar(255)	not null,
	CI_CAKEY	varchar(255)	not null,	
	DATA			blob(1G),
	constraint PK_CMCAKEYS primary key (CI_CAKEY)
) IN CMSCRIPT_CREATE_IN;

CREATE  UNIQUE  INDEX PK_CMCAKEYS ON CMCAKEYS (CI_CAKEY ASC ) USING STOGROUP CMSCRIPT_STOGROUP;  

CREATE AUXILIARY TABLE CMATB003
   IN CMSCRIPT_DATABASE.CMSCRIPT_CS_IDCML003
   STORES CMCAKEYS
   COLUMN DATA;

CREATE  UNIQUE  INDEX CMIDX003 ON CMATB003 USING STOGROUP CMSCRIPT_STOGROUP; 

create table CMCAPROPS (
	PROPNAME	varchar (50)	not null,
	PROPINTVALUE	integer 	not null,
	PROPVALUE	clob 	(1G),
	CONSTRAINT PK_CMCAPROPS PRIMARY KEY (PROPNAME)
) IN CMSCRIPT_CREATE_IN;

CREATE  UNIQUE  INDEX PK_CMCAPROPS ON CMCAPROPS (PROPNAME ASC ) USING STOGROUP CMSCRIPT_STOGROUP;

CREATE AUXILIARY TABLE CMATB004
   IN CMSCRIPT_DATABASE.CMSCRIPT_CS_IDCML004
   STORES CMCAPROPS
   COLUMN PROPVALUE;
 
CREATE  UNIQUE  INDEX CMIDX004 ON CMATB004 USING STOGROUP CMSCRIPT_STOGROUP;

insert into CMCAPROPS (PROPNAME, PROPINTVALUE, PROPVALUE) values ('FRESHNESS', 0, NULL);