Skip to content

Commit

Permalink
just use this.insert, it does not use transactions either
Browse files Browse the repository at this point in the history
  • Loading branch information
netroy committed Dec 12, 2023
1 parent b931194 commit 6296685
Showing 1 changed file with 7 additions and 20 deletions.
27 changes: 7 additions & 20 deletions packages/cli/src/databases/repositories/execution.repository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import type {
import config from '@/config';
import type { IGetExecutionsQueryFilter } from '@/executions/executions.service';
import { isAdvancedExecutionFiltersEnabled } from '@/executions/executionHelpers';
import { ExecutionData } from '../entities/ExecutionData';
import type { ExecutionData } from '../entities/ExecutionData';
import { ExecutionEntity } from '../entities/ExecutionEntity';
import { ExecutionMetadata } from '../entities/ExecutionMetadata';
import { ExecutionDataRepository } from './executionData.repository';
Expand Down Expand Up @@ -215,27 +215,14 @@ export class ExecutionRepository extends Repository<ExecutionEntity> {

async createNewExecution(execution: ExecutionPayload): Promise<string> {
const { data, workflowData, ...rest } = execution;
const { identifiers: inserted } = await this.manager
.createQueryBuilder()
.insert()
.into(ExecutionEntity)
.values([rest])
.execute();

const { identifiers: inserted } = await this.insert(rest);
const { id: executionId } = inserted[0] as { id: string };
const { connections, nodes, name } = workflowData ?? {};
await this.manager
.createQueryBuilder()
.insert()
.into(ExecutionData)
.values([
{
executionId,
workflowData: { connections, nodes, name },
data: stringify(data),
},
])
.execute();
await this.executionDataRepository.insert({
executionId,
workflowData: { connections, nodes, name },
data: stringify(data),
});
return String(executionId);
}

Expand Down

0 comments on commit 6296685

Please sign in to comment.