2023-02-17 01:54:07 -08:00
|
|
|
import { ExecutionStatus, WorkflowExecuteMode } from 'n8n-workflow';
|
2023-06-20 10:13:18 -07:00
|
|
|
import {
|
|
|
|
Column,
|
|
|
|
Entity,
|
|
|
|
Generated,
|
|
|
|
Index,
|
|
|
|
ManyToOne,
|
|
|
|
OneToMany,
|
|
|
|
OneToOne,
|
|
|
|
PrimaryColumn,
|
|
|
|
Relation,
|
2023-09-20 06:21:42 -07:00
|
|
|
DeleteDateColumn,
|
2023-06-20 10:13:18 -07:00
|
|
|
} from 'typeorm';
|
|
|
|
import { datetimeColumnType } from './AbstractEntity';
|
2023-01-02 08:42:32 -08:00
|
|
|
import { idStringifier } from '../utils/transformers';
|
2023-06-20 10:13:18 -07:00
|
|
|
import type { ExecutionData } from './ExecutionData';
|
2023-03-23 10:07:46 -07:00
|
|
|
import type { ExecutionMetadata } from './ExecutionMetadata';
|
2023-06-20 10:13:18 -07:00
|
|
|
import { WorkflowEntity } from './WorkflowEntity';
|
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'])
|
2023-06-20 10:13:18 -07:00
|
|
|
export class ExecutionEntity {
|
2023-01-02 08:42:32 -08:00
|
|
|
@Generated()
|
|
|
|
@PrimaryColumn({ transformer: idStringifier })
|
|
|
|
id: string;
|
2019-07-22 11:29:06 -07:00
|
|
|
|
|
|
|
@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;
|
|
|
|
|
2023-02-17 01:54:07 -08:00
|
|
|
@Column('varchar', { nullable: true })
|
|
|
|
status: ExecutionStatus;
|
|
|
|
|
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;
|
|
|
|
|
2023-09-20 06:21:42 -07:00
|
|
|
@DeleteDateColumn({ type: datetimeColumnType, nullable: true })
|
2023-09-04 05:34:03 -07:00
|
|
|
deletedAt: Date;
|
|
|
|
|
2023-06-20 10:13:18 -07:00
|
|
|
@Column({ nullable: true })
|
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 })
|
2023-03-30 02:12:29 -07:00
|
|
|
waitTill: Date | null;
|
2023-03-23 10:07:46 -07:00
|
|
|
|
|
|
|
@OneToMany('ExecutionMetadata', 'execution')
|
|
|
|
metadata: ExecutionMetadata[];
|
2023-06-20 10:13:18 -07:00
|
|
|
|
|
|
|
@OneToOne('ExecutionData', 'execution')
|
|
|
|
executionData: Relation<ExecutionData>;
|
|
|
|
|
|
|
|
@ManyToOne('WorkflowEntity')
|
|
|
|
workflow: WorkflowEntity;
|
2019-07-22 11:29:06 -07:00
|
|
|
}
|