在多服务并发提交数据时,可导致流程数据重复,造成审批数据困扰。为避免重复数据提交,可创建数据库组合唯一性约束
创建数据库约束
--创建约束
ALTER TABLE "public"."act_hi_varinst" ADD CONSTRAINT "CK_act_hi_varinst_001" UNIQUE ("proc_inst_id_", "execution_id_", "task_id_", "name_");
删除数据库约束
--如不需要组合唯一约束,可删除约束
--ALTER TABLE "public"."act_hi_varinst" DROP CONSTRAINT "CK_act_hi_varinst_001" ;
新建测试数据,新增至流程历史表
--创建测试数据
INSERT INTO "public"."act_hi_varinst"("id_", "proc_inst_id_", "execution_id_", "task_id_", "name_", "var_type_",
"rev_", "bytearray_id_", "double_", "long_", "text_", "text2_", "create_time_", "last_updated_time_")
SELECT id_generator(), '2000000200000000904', '2000000200000000904', '2000000200000000904', 'choice', 'integer',
0, NULL, NULL, 1, '1', NULL, '2000-07-11 10:51:02.038', '2000-07-11 10:51:02.038'
查询已有数据
--查询数据
SELECT * FROM act_hi_varinst WHERE proc_inst_id_='2000000200000000904'