-- Licensed Materials - Property of IBM
-- 5724-I68
--
-- (C) Copyright IBM Corp. 2000, 2006
--
-- US Government Users Restricted Rights - Use, duplication, or
-- disclosure restricted by GSA ADP Schedule Contract with IBM Corp.



update command options using c off;

-- ===================================================================
--
-- Table tevt_que_queue
--
-- Contains the flattened entries for the queue.
-- ===================================================================

drop table tevt_que_queue;
create table tevt_que_queue
( 
    que_id                        bigint,
    que_user_id                   bigint,
    que_cmp_id                    bigint,
    que_event_name                varchar(200),
    que_time_stamp                timestamp,
    que_message                   varchar(4000),
    que_params                    varchar(4000)
) 

in users index in indx;


drop synonym que;
create synonym que for tevt_que_queue;

drop sequence qevt_que_id restrict;
create sequence qevt_que_id start with 1 increment by 200 nocache;

-- ===================================================================
--
-- Table tevt_qpr_queue_pointer
--
-- Contains the pointer to the queue for the DeQueueing the of the queue by multiple
-- listeners.
-- ===================================================================

drop table tevt_qpr_queue_pointer;
create table tevt_qpr_queue_pointer
( 
    qpr_dequeue_id                bigint,
    qpr_pointer                   bigint
) 

in users index in indx;


drop synonym qpr;
create synonym qpr for tevt_qpr_queue_pointer;

-- ===================================================================
--
-- Table tevt_ald_alert_description
--

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

drop table tevt_ald_alert_description;
create table tevt_ald_alert_description
( 
    ald_arl_desc_id               bigint not null,
    ald_enabled                   char(1),
    ald_user_id                   bigint,
    ald_cmp_id                    bigint,
    ald_event_name                varchar(100),
    ald_condition                 varchar(1000),
    ald_alert_description         varchar(1000),
    constraint ald_0_pk
        primary key (ald_arl_desc_id)
) 

in users index in indx;


drop synonym ald;
create synonym ald for tevt_ald_alert_description;

drop sequence qevt_ald_arl_desc_id restrict;
create sequence qevt_ald_arl_desc_id start with 1 increment by 200 nocache;

-- ===================================================================
--
-- Table tevt_ads_alert_subscription
--

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

drop table tevt_ads_alert_subscription;
create table tevt_ads_alert_subscription
( 
    ads_arl_desc_id               bigint,
    ads_user_id_list              varchar(300),
    ads_cmp_id                    bigint,
    ads_dist_grps                 varchar(300),
    ads_dists                     varchar(300)
) 

in users index in indx;


drop synonym ads;
create synonym ads for tevt_ads_alert_subscription;

-- ===================================================================
--
-- Table tevt_act_actionables
--

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

drop table tevt_act_actionables;
create table tevt_act_actionables
( 
    act_id                        bigint not null,
    act_cmp_id                    bigint,
    act_type                      varchar(100),
    act_desc_sub_id               bigint,
    act_recipient_type            varchar(100),
    act_user_role_id              bigint,
    act_level                     varchar(100),
    act_event_group_name          varchar(25),
    act_event_name                varchar(200),
    act_param_values              varchar(200),
    act_time_stamp                timestamp,
    act_text                      varchar(4000),
    act_status                    varchar(100),
    constraint act_0_pk
        primary key (act_id)
) 

in users index in indx;


drop synonym act;
create synonym act for tevt_act_actionables;

drop sequence qevt_act_id restrict;
create sequence qevt_act_id start with 1 increment by 200 nocache;

-- ===================================================================
--
-- Table tevt_acm_actionable_messages
--
-- Currenlty this table will only contain the messages coming from external non-trigo sources but
-- ideally the alerts that are stored in the tevt_act_actionables table should also go here.
-- This table only contains the basic information about the alerts and messages and the remaining
-- information will go to the tevt_aca_actionable_attributes table as name value pairs.
-- ===================================================================

drop table tevt_acm_actionable_messages;
create table tevt_acm_actionable_messages
( 
    acm_id                        bigint not null,
    acm_cmp_id                    bigint,
    acm_queue_id                  bigint,
    acm_msg_id                    bigint,
    acm_action                    varchar(100),
    acm_state                     varchar(100),
    acm_type                      varchar(100),
    acm_recipient_type            varchar(100),
    acm_status                    varchar(100),
    acm_time_stamp                timestamp,
    acm_comment                   varchar(3000),
    constraint acm_0_pk
        primary key (acm_id)
) 

in users index in indx;


drop synonym acm;
create synonym acm for tevt_acm_actionable_messages;

drop sequence qevt_acm_id restrict;
create sequence qevt_acm_id start with 1 increment by 200 nocache;

-- ===================================================================
--
-- Table tevt_aca_actionable_attributes
--
-- Contains the attributes as name value pairs for the tevt_acm_actionable_messages table.
-- ===================================================================

drop table tevt_aca_actionable_attributes;
create table tevt_aca_actionable_attributes
( 
    aca_actionable_id             bigint not null,
    aca_cmp_id                    bigint,
    aca_name                      varchar(100),
    aca_value                     varchar(3000),
    constraint aca_0_pk
        primary key (aca_actionable_id)
) 

in users index in indx;


drop synonym aca;
create synonym aca for tevt_aca_actionable_attributes;

-- ===================================================================
--
-- Table tevt_ccp_calendar_cmp_pref
--

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

drop table tevt_ccp_calendar_cmp_pref;
create table tevt_ccp_calendar_cmp_pref
( 
    ccp_company_id                bigint,
    ccp_event_name                varchar(200)
) 

in users index in indx;


drop synonym ccp;
create synonym ccp for tevt_ccp_calendar_cmp_pref;



commit;

update command options using c on;

terminate;