/*==============================================================*/
/* @table: rt_p_case (rt_p_001)                                 */
/*                                                              */
/* @desc:                                                       */
/*                                                              */
/* @created: 2004-4-4 16:02                                     */
/*                                                              */
/* @comment:                                                    */
/*                                                              */
/*==============================================================*/
create table rt_p_case
(
vc_packageid       varchar(50)    not null,   
vc_processid       varchar(50)    not null,   
vc_uuid            varchar(50)    not null,   
vc_name            varchar(50)    ,           
vc_primarykey      varchar(50)    not null,   
vc_creator         varchar(50)    ,           
dat_creationtime   datetime       not null,    
int_status         int(10)        not null,   
vc_description     varchar(255),
primary key(vc_packageid,vc_processid,vc_uuid)
);

/*==============================================================*/
/* @table: rt_p_work (rt_p_002)                                 */
/*                                                              */
/* @desc:                                                       */
/*                                                              */
/* @created: 2004-4-4 16:02                                     */
/*                                                              */
/* @comment:                                                    */
/*                                                              */
/*==============================================================*/
create table rt_p_work
(
vc_packageid          varchar(50)    not null,    
vc_processid          varchar(50)    not null,    
vc_caseid             varchar(50)    not null,    
vc_owner_processid    varchar(50)    ,            
vc_activityid         varchar(50)    not null,    
vc_uuid               varchar(50)    not null,    
vc_performer          varchar(50)    ,            
dat_arriveTime        datetime            ,       
dat_acceptTime        datetime            ,       
dat_dispatchTime      datetime            ,       
vc_parent_workid      varchar(50)    ,            
vc_entityid           varchar(50)    ,  
primary key(vc_packageid,vc_processid,vc_caseid,vc_uuid)
);

/*==============================================================*/
/* @table: rt_p_path (rt_p_003)                                 */
/*                                                              */
/* @desc:                                                       */
/*                                                              */
/* @created: 2004-4-4 16:02                                     */
/*                                                              */
/* @comment:                                                    */
/*                                                              */
/*==============================================================*/
create table rt_p_path
(
vc_packageid          varchar(50)    not null, 
vc_processid          varchar(50)    not null, 
vc_caseid             varchar(50)    not null, 
vc_uuid               varchar(50)    not null, 
vc_from               varchar(50)            , 
vc_to                 varchar(50)            , 
vc_owner_processid    varchar(50)            , 
vc_transitionid       varchar(50)            , 
vc_batchNo            varchar(50)            , 
int_eventType         int(10)      not null    
);

/*==============================================================*/
/* @table: rt_p_datafield (rt_p_004)                            */
/*                                                              */
/* @desc:                                                       */
/*                                                              */
/* @created: 2004-4-4 16:02                                     */
/*                                                              */
/* @comment:                                                    */
/*                                                              */
/*==============================================================*/
create table rt_p_datafield
(
vc_packageid     varchar(50)    not null, 
vc_processid     varchar(50)    not null, 
vc_caseid        varchar(50)    not null, 
vc_uuid          varchar(50)    not null, 
vc_type          varchar(50)    not null, 
vc_value         varchar(50)    ,        
primary key(vc_packageid,vc_processid,vc_caseid,vc_uuid)
);

/*==============================================================*/
/* @table: rt_p_caseevent (rt_p_005)                            */
/*                                                              */
/* @desc:                                                       */
/*                                                              */
/* @created: 2004-4-4 17:40                                     */
/*                                                              */
/* @comment: EVENT TYPE                                         */
/*                                                              */
/*==============================================================*/
create table rt_p_caseevent
(
vc_packageid     varchar(50)    not null, 
vc_processid     varchar(50)    not null, 
vc_caseid        varchar(50)    not null, 
int_type         int(10)      not null, 
vc_operator      varchar(50)    not null, 
dat_optime       datetime            not null, 
vc_description   varchar(255)           
);


/*==============================================================*/
/* @table: rt_p_workevent (rt_p_006)                            */
/*                                                              */
/* @desc:                                                       */
/*                                                              */
/* @created: 2004-4-5 9:07                                      */
/*                                                              */
/* @comment: EVENT TYPE                                         */
/*                                                              */
/*==============================================================*/
create table rt_p_workevent
(
vc_packageid     varchar(50)    not null,
vc_processid     varchar(50)    not null, 
vc_caseid        varchar(50)    not null,
vc_workid        varchar(50)    not null, 
int_type         int(10)      not null, 
vc_operator      varchar(50)    not null, 
dat_optime       datetime            not null,
vc_description   varchar(255)       
);

/*==============================================================*/
/* @table: rt_p_activity_dispatch (rt_p_007)                    */
/*--------------------------------------------------------------*/
/* only used internally                                         */
/*--------------------------------------------------------------*/
/*                                                              */
/* @desc:  WorkflowActivity dispatch batch history              */
/*         only used by Join WorkflowActivity                   */
/*         and it's former  WorkflowActivity                    */
/*                                                              */
/* @created: 2004-4-5 9:07                                      */
/*                                                              */
/*==============================================================*/
create table rt_p_activity_dispatch
(
vc_packageid          varchar(50)    not null, 
vc_processid          varchar(50)    not null, 
vc_caseid             varchar(50)    not null, 
vc_owner_processid    varchar(50)    ,         
vc_activityid         varchar(50)    not null, 
int_batchNo           int(10)        not null, 
int_join_monitor      int(10)        , 
vc_disp_flag          varchar(20)
);