-- IBM Confidential
-- OCO Source Materials
-- 5724-I68.
-- (C) Copyright IBM Corp. 2000, 2006 - All Rights Reserved.
-- US Government Users Restricted Rights - Use, duplication or disclosure 
-- restricted by GSA ADP Schedule Contract with IBM Corp. 

-- Add a column where it doesn't already exist
alter table tctg_ita_item_attributes add column ita_occurrence_id integer ;
commit;

-- Set a default value for rows not already populated (prevents loss of data)
update ita set ita_occurrence_id=-1 where ita_occurrence_id is null;
commit;

drop index ictg_ita_0;
create index ictg_ita_0 on tctg_ita_item_attributes (
        ita_item_id,
        ita_next_version_id,
        ita_version_id,
        ita_catalog_id,
        ita_node_id,
        ita_occurrence_id
)   ALLOW REVERSE SCANS;

drop index ictg_ita_1;
create index ictg_ita_1 on tctg_ita_item_attributes (
        ita_node_id,
        ita_value_numeric,
        ita_next_version_id,
        ita_version_id,
        ita_catalog_id,
        ita_occurrence_id,
        ita_item_id
)   ALLOW REVERSE SCANS;

drop index ictg_ita_2;
create index ictg_ita_2 on tctg_ita_item_attributes (
        ita_node_id,
        ita_value_string,
        ita_next_version_id,
        ita_version_id,
        ita_catalog_id,
        ita_occurrence_id,
        ita_item_id
)   ALLOW REVERSE SCANS;

commit;
