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


drop table CMDELETEDSCHEDULES

alter table CMOBJPROPS2 drop constraint PK_CMOBJPROPS2

rename CMOBJPROPS2 to CMOBJPROPS2_OLD

create table CMOBJPROPS2 (
	CMID			integer not null,
	TASKID			varchar(32),
	STARTDATE		timestamp,
	ENDDATE			timestamp,
	ENDTYPE			smallint,
	EVERYNPERIODS	integer,
	DAILYPERIOD		smallint,
	MONTHLYABSDAY	smallint,
	MONTHLYRELDAY	smallint,
	MONTHLYRELWEEK	smallint,
	TYPE			smallint,
	YEARLYABSDAY	smallint,
	YEARLYABSMONTH	smallint,
	YEARLYRELDAY	smallint,
	YEARLYRELMONTH	smallint,
	YEARLYRELWEEK	smallint,
	ACTIVE			decimal(1,0) default 0 not null,
	WEEKLYMONDAY	decimal(1,0) default 0 not null,
	WEEKLYTUESDAY	decimal(1,0) default 0 not null,
	WEEKLYWEDNESDAY	decimal(1,0) default 0 not null,
	WEEKLYTHURSDAY	decimal(1,0) default 0 not null,
	WEEKLYFRIDAY	decimal(1,0) default 0 not null,
	WEEKLYSATURDAY	decimal(1,0) default 0 not null,
	WEEKLYSUNDAY	decimal(1,0) default 0 not null, 
	constraint PK_CMOBJPROPS2 primary key (CMID) 
)

insert into CMOBJPROPS2(CMID,TASKID,STARTDATE,ENDDATE,ENDTYPE,EVERYNPERIODS,DAILYPERIOD,MONTHLYABSDAY,MONTHLYRELDAY,MONTHLYRELWEEK,TYPE,YEARLYABSDAY,YEARLYABSMONTH,YEARLYRELDAY,YEARLYRELMONTH,YEARLYRELWEEK,ACTIVE,WEEKLYMONDAY,WEEKLYTUESDAY,WEEKLYWEDNESDAY,WEEKLYTHURSDAY,WEEKLYFRIDAY,WEEKLYSATURDAY,WEEKLYSUNDAY) select CMID,TASKID,STARTDATE,ENDDATE,ENDTYPE,EVERYNPERIODS,DAILYPERIOD,MONTHLYABSDAY,MONTHLYRELDAY,MONTHLYRELWEEK,TYPE,YEARLYABSDAY,YEARLYABSMONTH,YEARLYRELDAY,YEARLYRELMONTH,YEARLYRELWEEK,ACTIVE,WEEKLYMONDAY,WEEKLYTUESDAY,WEEKLYWEDNESDAY,WEEKLYTHURSDAY,WEEKLYFRIDAY,WEEKLYSATURDAY,WEEKLYSUNDAY from CMOBJPROPS2_OLD

drop table CMOBJPROPS2_OLD
