Fix workflow instance deletion for Postgres
This commit is contained in:
parent
af3dcf5a4b
commit
6e71b1d43b
|
|
@ -6,6 +6,7 @@ using System.Threading.Tasks;
|
|||
using AutoMapper;
|
||||
using EFCore.BulkExtensions;
|
||||
using Elsa.Models;
|
||||
using Elsa.Persistence.EntityFramework.Core.Extensions;
|
||||
using Elsa.Persistence.EntityFramework.Core.Services;
|
||||
using Elsa.Persistence.Specifications;
|
||||
using Elsa.Serialization;
|
||||
|
|
@ -28,9 +29,9 @@ namespace Elsa.Persistence.EntityFramework.Core.Stores
|
|||
|
||||
await DoWork(async dbContext =>
|
||||
{
|
||||
await dbContext.Set<WorkflowExecutionLogRecord>().AsQueryable().Where(x => x.WorkflowInstanceId == workflowInstanceId).BatchDeleteAsync(cancellationToken);
|
||||
await dbContext.Set<Bookmark>().AsQueryable().Where(x => x.WorkflowInstanceId == workflowInstanceId).BatchDeleteAsync(cancellationToken);
|
||||
await dbContext.Set<WorkflowInstance>().AsQueryable().Where(x => x.Id == workflowInstanceId).BatchDeleteAsync(cancellationToken);
|
||||
await dbContext.Set<WorkflowExecutionLogRecord>().AsQueryable().Where(x => x.WorkflowInstanceId == workflowInstanceId).BatchDeleteWithWorkAroundAsync(dbContext, cancellationToken);
|
||||
await dbContext.Set<Bookmark>().AsQueryable().Where(x => x.WorkflowInstanceId == workflowInstanceId).BatchDeleteWithWorkAroundAsync(dbContext, cancellationToken);
|
||||
await dbContext.Set<WorkflowInstance>().AsQueryable().Where(x => x.Id == workflowInstanceId).BatchDeleteWithWorkAroundAsync(dbContext, cancellationToken);
|
||||
}, cancellationToken);
|
||||
}
|
||||
|
||||
|
|
@ -41,9 +42,9 @@ namespace Elsa.Persistence.EntityFramework.Core.Stores
|
|||
|
||||
await DoWork(async dbContext =>
|
||||
{
|
||||
await dbContext.Set<WorkflowExecutionLogRecord>().AsQueryable().Where(x => workflowInstanceIds.Contains(x.WorkflowInstanceId)).BatchDeleteAsync(cancellationToken);
|
||||
await dbContext.Set<Bookmark>().AsQueryable().Where(x => workflowInstanceIds.Contains(x.WorkflowInstanceId)).BatchDeleteAsync(cancellationToken);
|
||||
await dbContext.Set<WorkflowInstance>().AsQueryable().Where(x => workflowInstanceIds.Contains(x.Id)).BatchDeleteAsync(cancellationToken);
|
||||
await dbContext.Set<WorkflowExecutionLogRecord>().AsQueryable().Where(x => workflowInstanceIds.Contains(x.WorkflowInstanceId)).BatchDeleteWithWorkAroundAsync(dbContext, cancellationToken);
|
||||
await dbContext.Set<Bookmark>().AsQueryable().Where(x => workflowInstanceIds.Contains(x.WorkflowInstanceId)).BatchDeleteWithWorkAroundAsync(dbContext, cancellationToken);
|
||||
await dbContext.Set<WorkflowInstance>().AsQueryable().Where(x => workflowInstanceIds.Contains(x.Id)).BatchDeleteWithWorkAroundAsync(dbContext, cancellationToken);
|
||||
}, cancellationToken);
|
||||
|
||||
return workflowInstances.Count;
|
||||
|
|
|
|||
Loading…
Reference in a new issue