dbUpgrade4_0102-to-4_0103_db2.sql 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. -- Licensed Materials - Property of IBM
  2. --
  3. -- BI and PM: CM
  4. --
  5. -- (C) Copyright IBM Corp. 2008, 2009
  6. --
  7. -- US Government Users Restricted Rights - Use, duplication or disclosure
  8. -- restricted by GSA ADP Schedule Contract with IBM Corp.
  9. -- Copyright (C) 2008 Cognos ULC, an IBM Company. All rights reserved.
  10. -- Cognos (R) is a trademark of Cognos ULC, (formerly Cognos Incorporated).
  11. create table CMOBJECTS_OLD (
  12. CMID integer not null,
  13. PCMID integer not null,
  14. VERSION integer default 1 not null,
  15. CREATED timestamp not null,
  16. MODIFIED timestamp not null,
  17. DISABLED smallint,
  18. CLASSID smallint not null,
  19. DISPSEQ integer with default 0 not null,
  20. OWNER integer
  21. )
  22. insert into CMOBJECTS_OLD
  23. select CMID,PCMID,VERSION,CREATED,MODIFIED,DISABLED,CLASSID,DISPSEQ,OWNER
  24. from CMOBJECTS
  25. drop view CMOWNERCOUNT
  26. drop table CMOBJECTS
  27. alter table CMOBJECTS_OLD add constraint PK_CMOBJECTS primary key (CMID)
  28. alter table CMOBJECTS_OLD add constraint PK_CMPARENT unique (PCMID,CMID)
  29. rename table CMOBJECTS_OLD to CMOBJECTS
  30. create index IDX_CLASS on CMOBJECTS(CLASSID)
  31. create index IDX_CLASS1 on CMOBJECTS(CMID,CLASSID)
  32. create index IDX_PARENT on CMOBJECTS(PCMID)
  33. create index IDX_CREATED on CMOBJECTS(CREATED)
  34. create view CMOWNERCOUNT(OBJID,OWN_NUMBER) as
  35. select p2.OBJID, count(o.CMID)
  36. from CMOBJECTS o left outer join CMREFNOORD2 p1 on p1.CMID=o.CMID
  37. left outer join CMOBJPROPS1 p2 on p1.REFCMID=p2.CMID
  38. group by p2.OBJID
  39. alter table CMOBJPROPS55 add HIDDEN decimal(1,0) default 0 not null