create table sj_job_summary
(
    id               bigint unsigned auto_increment comment '主键'
        primary key,
    namespace_id     varchar(64)  default '764d604ec6fc45f68cd92514c40e9e1a' not null comment '命名空间id',
    group_name       varchar(64)  default ''                                 not null comment '组名称',
    business_id      bigint                                                  not null comment '业务id (job_id或workflow_id)',
    system_task_type tinyint      default 3                                  not null comment '任务类型 3、JOB任务 4、WORKFLOW任务',
    trigger_at       datetime     default CURRENT_TIMESTAMP                  not null comment '统计时间',
    success_num      int          default 0                                  not null comment '执行成功-日志数量',
    fail_num         int          default 0                                  not null comment '执行失败-日志数量',
    fail_reason      varchar(512) default ''                                 not null comment '失败原因',
    stop_num         int          default 0                                  not null comment '执行失败-日志数量',
    stop_reason      varchar(512) default ''                                 not null comment '失败原因',
    cancel_num       int          default 0                                  not null comment '执行失败-日志数量',
    cancel_reason    varchar(512) default ''                                 not null comment '失败原因',
    create_dt        datetime     default CURRENT_TIMESTAMP                  not null comment '创建时间',
    update_dt        datetime     default CURRENT_TIMESTAMP                  not null on update CURRENT_TIMESTAMP comment '修改时间',
    constraint uk_trigger_at_system_task_type_business_id
        unique (trigger_at, system_task_type, business_id)
)
    comment 'DashBoard_Job';

create index idx_namespace_id_group_name_business_id
    on sj_job_summary (namespace_id, group_name, business_id);

