2023-01-27 05:56:56 -08:00
|
|
|
import { WorkflowExecuteMode } from 'n8n-workflow';
|
2023-01-02 08:42:32 -08:00
|
|
|
import { Column, Entity, Generated, Index, PrimaryColumn } from 'typeorm';
|
2022-10-21 03:29:25 -07:00
|
|
|
import { datetimeColumnType, jsonColumnType } from './AbstractEntity';
|
2023-01-27 05:56:56 -08:00
|
|
|
import { IWorkflowDb } from '@/Interfaces';
|
|
|
|
import type { IExecutionFlattedDb } from '@/Interfaces';
|
2023-01-02 08:42:32 -08:00
|
|
|
import { idStringifier } from '../utils/transformers';
|
2019-07-22 11:29:06 -07:00
|
|
|
|
|
|
|
@Entity()
|
2022-02-18 06:59:34 -08:00
|
|
|
@Index(['workflowId', 'id'])
|
|
|
|
@Index(['waitTill', 'id'])
|
|
|
|
@Index(['finished', 'id'])
|
|
|
|
@Index(['workflowId', 'finished', 'id'])
|
|
|
|
@Index(['workflowId', 'waitTill', 'id'])
|
2019-07-22 11:29:06 -07:00
|
|
|
export class ExecutionEntity implements IExecutionFlattedDb {
|
2023-01-02 08:42:32 -08:00
|
|
|
@Generated()
|
|
|
|
@PrimaryColumn({ transformer: idStringifier })
|
|
|
|
id: string;
|
2019-07-22 11:29:06 -07:00
|
|
|
|
|
|
|
@Column('text')
|
|
|
|
data: string;
|
|
|
|
|
|
|
|
@Column()
|
|
|
|
finished: boolean;
|
|
|
|
|
2019-12-21 13:04:47 -08:00
|
|
|
@Column('varchar')
|
2019-07-22 11:29:06 -07:00
|
|
|
mode: WorkflowExecuteMode;
|
|
|
|
|
|
|
|
@Column({ nullable: true })
|
|
|
|
retryOf: string;
|
|
|
|
|
|
|
|
@Column({ nullable: true })
|
|
|
|
retrySuccessId: string;
|
|
|
|
|
2022-10-21 03:29:25 -07:00
|
|
|
@Column(datetimeColumnType)
|
2019-07-22 11:29:06 -07:00
|
|
|
startedAt: Date;
|
|
|
|
|
2020-07-17 08:08:40 -07:00
|
|
|
@Index()
|
2022-10-21 03:29:25 -07:00
|
|
|
@Column({ type: datetimeColumnType, nullable: true })
|
2019-07-22 11:29:06 -07:00
|
|
|
stoppedAt: Date;
|
|
|
|
|
2022-10-21 03:29:25 -07:00
|
|
|
@Column(jsonColumnType)
|
2019-07-22 11:29:06 -07:00
|
|
|
workflowData: IWorkflowDb;
|
|
|
|
|
2023-01-02 08:42:32 -08:00
|
|
|
@Column({ nullable: true, transformer: idStringifier })
|
2019-07-22 11:29:06 -07:00
|
|
|
workflowId: string;
|
2021-08-21 05:11:32 -07:00
|
|
|
|
2022-10-21 03:29:25 -07:00
|
|
|
@Column({ type: datetimeColumnType, nullable: true })
|
2021-08-21 05:11:32 -07:00
|
|
|
waitTill: Date;
|
2019-07-22 11:29:06 -07:00
|
|
|
}
|