create table ext_ax_bpmn_form_relation
(
    id                 bigint auto_increment comment '主键' primary key,
    `key`              varchar(64) default ''                not null comment '业务标识',
    bpmn_definition_id varchar(64) default ''                not null comment 'BPMN定义 ID',
    form_deployment_id varchar(64) default ''                not null comment '表单部署 ID',
    tenant_id          varchar(64) default ''                not null comment '租户 ID',
    update_by          bigint      default 0                 not null comment '更新人',
    update_at          datetime    default CURRENT_TIMESTAMP not null on update CURRENT_TIMESTAMP comment '更新时间',
    create_at          datetime    default CURRENT_TIMESTAMP not null comment '创建时间',
    create_by          bigint      default 0                 not null comment '创建人',
    is_delete          bigint      default 0                 not null comment '是否删除:0否,1是'
);

create index idx_key_def_form
    on ext_ax_bpmn_form_relation (bpmn_definition_id desc, `key` asc, tenant_id asc, is_delete asc);

-- 优化 oms 审批数据查询功能
create index idx_start_time_proc_def
    on act_hi_procinst (START_TIME_ desc, PROC_DEF_ID_);

-- 流程日志表增加字段权限配置
alter table ext_ax_process_log
    add form_field_permission_conf json null comment '表单字段权限' after button_conf;

