create table sj_workflow_task_batch
(
    id                bigint unsigned auto_increment comment '主键'
        primary key,
    namespace_id      varchar(64)  default '764d604ec6fc45f68cd92514c40e9e1a' not null comment '命名空间id',
    group_name        varchar(64)                                             not null comment '组名称',
    workflow_id       bigint                                                  not null comment '工作流任务id',
    task_batch_status tinyint      default 0                                  not null comment '任务批次状态 0、失败 1、成功',
    operation_reason  tinyint      default 0                                  not null comment '操作原因',
    flow_info         text                                                    null comment '流程信息',
    wf_context        text                                                    null comment '全局上下文',
    execution_at      bigint       default 0                                  not null comment '任务执行时间',
    ext_attrs         varchar(256) default ''                                 null comment '扩展字段',
    version           int          default 1                                  not null comment '版本号',
    deleted           tinyint      default 0                                  not null comment '逻辑删除 1、删除',
    create_dt         datetime     default CURRENT_TIMESTAMP                  not null comment '创建时间',
    update_dt         datetime     default CURRENT_TIMESTAMP                  not null on update CURRENT_TIMESTAMP comment '修改时间'
)
    comment '工作流批次';

create index idx_create_dt
    on sj_workflow_task_batch (create_dt);

create index idx_job_id_task_batch_status
    on sj_workflow_task_batch (workflow_id, task_batch_status);

create index idx_namespace_id_group_name
    on sj_workflow_task_batch (namespace_id, group_name);

