-- IBM Confidential
-- OCO Source Materials
-- 5724-I68.
-- (C) Copyright IBM Corp. 2000, 2004 - All Rights Reserved.
-- US Government Users Restricted Rights - Use, duplication or disclosure 
-- restricted by GSA ADP Schedule Contract with IBM Corp. 
-- This file is generated by GenSchema!! DO NOT EDIT!!!
-- This file is generated by GenSchema!! DO NOT EDIT!!!


-- ===================================================================
--
-- Table tcnt_sen_selected_entry
--
-- Contains the mapping of items  and selection_id.
-- ===================================================================

drop table tcnt_sen_selected_entry cascade constraints;
create table tcnt_sen_selected_entry
( 
    sen_company_id                number(9, 0),
    sen_selection_id              number(9, 0),
    sen_src_container_id          number(9, 0),
    sen_selected_container_id     number(9, 0),
    sen_entry_id                  number(9, 0),
    sen_get_children              varchar2(80)
) 
tablespace users;


drop synonym sen;
create synonym sen for tcnt_sen_selected_entry;

-- ===================================================================
--
-- Table tcnt_cnt_container
--
-- A container has attributes as described in the tcnt_cna_container_attributes table (cna).
-- A company has many cotainer.
-- A container name is unique to a company for a given type.  This is enforced.
-- A container id is unique.  This is enforced.
-- ===================================================================

drop table tcnt_cnt_container cascade constraints;
create table tcnt_cnt_container
( 
    cnt_company_id                number(9, 0),
    cnt_id                        number(9, 0),
    cnt_name                      varchar2(100),
    cnt_type                      varchar2(100),
    cnt_object_group_id           number(9, 0),
    cnt_container_type            varchar2(128)
) 
tablespace users;


drop synonym cnt;
create synonym cnt for tcnt_cnt_container;

drop sequence qcnt_cnt_id;
create sequence qcnt_cnt_id start with 1 increment by 200 nocache;

-- ===================================================================
--
-- Table tcnt_cna_container_attributes
--
-- Extra attributes for a container are kept in name value pairs.
-- A name may exist multiple times for a particular catalog.
-- ===================================================================

drop table tcnt_cna_container_attributes cascade constraints;
create table tcnt_cna_container_attributes
( 
    cna_company_id                number(9, 0),
    cna_container_id              number(9, 0),
    cna_name                      varchar2(100),
    cna_value                     varchar2(800),
    cna_version_id                number(9, 0),
    cna_next_version_id           number(9, 0)
) 
tablespace users;


drop synonym cna;
create synonym cna for tcnt_cna_container_attributes;

-- ===================================================================
--
-- Table tcnt_ent_entry
--
-- This is the entry table. We keep all attributes for an entry whether inherited from the
-- container specification or from the set of categories the entry belongs to in the entry
-- attributes table. So we can have 2 entries that belong to the same catalog but have a
-- different number of attributes.
-- ===================================================================

drop table tcnt_ent_entry cascade constraints;
create table tcnt_ent_entry
( 
    ent_company_id                number(9, 0),
    ent_id                        number(9, 0),
    ent_container_id              number(9, 0) not null,
    ent_primary_key               varchar2(300) not null,
    ent_version_id                number(9, 0),
    ent_next_version_id           number(9, 0) not null,
    ent_status                    varchar2(300),
    ent_collab_info               varchar2(3000),
    ent_entry_type                varchar2(128),
    constraint ent_1_uk
        unique (ent_container_id, ent_primary_key, ent_next_version_id)
) 
tablespace users;


drop synonym ent;
create synonym ent for tcnt_ent_entry;

drop sequence qcnt_ent_id;
create sequence qcnt_ent_id start with 1 increment by 200 nocache;

-- ===================================================================
--
-- Table tcnt_eta_entry_attributes
--
-- Table holding name value pairs for entry attributes.  The type column tells you whether the
-- value for this attribute is of basic type numeric, string, or date.  The node id is the name
-- part of our name-value pair.  It is the id of the node of type attribute in a spec.  Please
-- read Versioning Howto.
-- NOTE: ADDING THE DBNAME ATTRIBUTE TO THE VALUE_NUMERIC COLUMN THE LENGTH FOR ORACLE WOULD BE
-- 38,12, AND FOR DB2 IT WILL BE 31, 12 ... DB LIMIT !!
-- NOTE: IF YOU CHANGE THIS CHANGE TCTG_CAB_CATEGORY_ATTRIBUTES TOO (SAME SETUP AS THIS)
-- ===================================================================

drop table tcnt_eta_entry_attributes cascade constraints;
create table tcnt_eta_entry_attributes
( 
    eta_company_id                number(9, 0),
    eta_container_id              number(9, 0),
    eta_entry_id                  number(9, 0),
    eta_node_id                   number(9, 0),
    eta_value_numeric             number(38, 12),
    eta_value_string              varchar2(3000),
    eta_version_id                number(9, 0),
    eta_next_version_id           number(9, 0)
) 
tablespace users;


drop synonym eta;
create synonym eta for tcnt_eta_entry_attributes;

-- ===================================================================
--
-- Table tcnt_esa_entry_sys_attr
--
-- Table holding the system (internal use only) attributes of a category -- name and value.
-- NOTE: CHANGED VALUE COLUMN LENGTH TO 850 TO REDUCE THE SIZE OF THE INDEX - DB2
-- ===================================================================

drop table tcnt_esa_entry_sys_attr cascade constraints;
create table tcnt_esa_entry_sys_attr
( 
    esa_company_id                number(9),
    esa_container_id              number(9),
    esa_entry_id                  number(9),
    esa_name                      varchar2(100),
    esa_value                     varchar2(850),
    esa_version_id                number(9, 0),
    esa_next_version_id           number(9, 0)
) 
tablespace users;


drop synonym esa;
create synonym esa for tcnt_esa_entry_sys_attr;

-- ===================================================================
--
-- Table tcnt_esm_entry_spec_map
--
-- Table holding mapping between categories and specs
-- ===================================================================

drop table tcnt_esm_entry_spec_map cascade constraints;
create table tcnt_esm_entry_spec_map
( 
    esm_company_id                number(9),
    esm_container_id              number(9),
    esm_entry_id                  number(9),
    esm_spec_id                   number(9),
    esm_filter_container_id       number(9),
    esm_version_id                number(9, 0),
    esm_next_version_id           number(9, 0)
) 
tablespace users;


drop synonym esm;
create synonym esm for tcnt_esm_entry_spec_map;

-- ===================================================================
--
-- Table tcnt_efp_entry_full_paths
--
-- Table holding the full paths of an entry
-- Patrice & Saad: This should never be queried by anyone other than the search dynamic queries
-- ===================================================================

drop table tcnt_efp_entry_full_paths cascade constraints;
create table tcnt_efp_entry_full_paths
( 
    efp_company_id                number(9),
    efp_container_id              number(9) not null,
    efp_entry_id                  number(9),
    efp_full_path_type            varchar2(100) not null,
    efp_full_path                 varchar2(850) not null,
    efp_version_id                number(9, 0),
    efp_next_version_id           number(9, 0) not null,
    constraint efp_0_uk
        unique (efp_container_id, efp_full_path_type, efp_full_path, efp_next_version_id)
) 
tablespace users;


drop synonym efp;
create synonym efp for tcnt_efp_entry_full_paths;

-- ===================================================================
--
-- Table tcnt_ehi_entry_hierarchy
--

-- ===================================================================

drop table tcnt_ehi_entry_hierarchy cascade constraints;
create table tcnt_ehi_entry_hierarchy
( 
    ehi_company_id                number(9),
    ehi_container_id              number(9, 0),
    ehi_container_type            varchar2(100),
    ehi_parent_id                 number(9, 0),
    ehi_child_id                  number(9, 0),
    ehi_version_id                number(9, 0),
    ehi_next_version_id           number(9, 0)
) 
tablespace users;


drop synonym ehi;
create synonym ehi for tcnt_ehi_entry_hierarchy;

-- ===================================================================
--
-- Table tcnt_eem_entry_entry_map
--
-- Mapping between a source and a destination entry..
-- ===================================================================

drop table tcnt_eem_entry_entry_map cascade constraints;
create table tcnt_eem_entry_entry_map
( 
    eem_company_id                number(9),
    eem_src_entry_id              number(9, 0),
    eem_src_container_id          number(9, 0),
    eem_dst_entry_id              number(9, 0),
    eem_dst_container_id          number(9, 0),
    eem_version_id                number(9, 0),
    eem_next_version_id           number(9, 0),
    eem_map_type                  varchar2(300)
) 
tablespace users;


drop synonym eem;
create synonym eem for tcnt_eem_entry_entry_map;

insert into ver (ver_id) select qctg_ver_id.nextval from dual;
insert into ver (ver_id) select qctg_ver_id.nextval from dual;
insert into ver (ver_id) select qctg_ver_id.nextval from dual;
insert into ver (ver_id) select qctg_ver_id.nextval from dual;
drop sequence qctg_agg_aggregation_queue_seq;
create sequence qctg_agg_aggregation_queue_seq start with 1 increment by 1 nocache;


