mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 10:02:05 +00:00
refactor(core): Make execution status non-nullable (no-changelog) (#9483)
This commit is contained in:
@@ -40,7 +40,7 @@ export class ExecutionEntity {
|
|||||||
@Column({ nullable: true })
|
@Column({ nullable: true })
|
||||||
retrySuccessId: string;
|
retrySuccessId: string;
|
||||||
|
|
||||||
@Column('varchar', { nullable: true })
|
@Column('varchar')
|
||||||
status: ExecutionStatus;
|
status: ExecutionStatus;
|
||||||
|
|
||||||
@Column(datetimeColumnType)
|
@Column(datetimeColumnType)
|
||||||
|
|||||||
@@ -0,0 +1,22 @@
|
|||||||
|
import type { IrreversibleMigration, MigrationContext } from '@/databases/types';
|
||||||
|
|
||||||
|
export class MakeExecutionStatusNonNullable1714133768521 implements IrreversibleMigration {
|
||||||
|
async up({ escape, runQuery, schemaBuilder }: MigrationContext) {
|
||||||
|
const executionEntity = escape.tableName('execution_entity');
|
||||||
|
const status = escape.columnName('status');
|
||||||
|
const finished = escape.columnName('finished');
|
||||||
|
|
||||||
|
const query = `
|
||||||
|
UPDATE ${executionEntity}
|
||||||
|
SET ${status} = CASE
|
||||||
|
WHEN ${finished} = true THEN 'success'
|
||||||
|
WHEN ${finished} = false THEN 'error'
|
||||||
|
END
|
||||||
|
WHERE ${status} IS NULL;
|
||||||
|
`;
|
||||||
|
|
||||||
|
await runQuery(query);
|
||||||
|
|
||||||
|
await schemaBuilder.addNotNull('execution_entity', 'status');
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -56,6 +56,7 @@ import { DropRoleMapping1705429061930 } from '../common/1705429061930-DropRoleMa
|
|||||||
import { RemoveFailedExecutionStatus1711018413374 } from '../common/1711018413374-RemoveFailedExecutionStatus';
|
import { RemoveFailedExecutionStatus1711018413374 } from '../common/1711018413374-RemoveFailedExecutionStatus';
|
||||||
import { MoveSshKeysToDatabase1711390882123 } from '../common/1711390882123-MoveSshKeysToDatabase';
|
import { MoveSshKeysToDatabase1711390882123 } from '../common/1711390882123-MoveSshKeysToDatabase';
|
||||||
import { RemoveNodesAccess1712044305787 } from '../common/1712044305787-RemoveNodesAccess';
|
import { RemoveNodesAccess1712044305787 } from '../common/1712044305787-RemoveNodesAccess';
|
||||||
|
import { MakeExecutionStatusNonNullable1714133768521 } from '../common/1714133768521-MakeExecutionStatusNonNullable';
|
||||||
|
|
||||||
export const mysqlMigrations: Migration[] = [
|
export const mysqlMigrations: Migration[] = [
|
||||||
InitialMigration1588157391238,
|
InitialMigration1588157391238,
|
||||||
@@ -115,4 +116,5 @@ export const mysqlMigrations: Migration[] = [
|
|||||||
MoveSshKeysToDatabase1711390882123,
|
MoveSshKeysToDatabase1711390882123,
|
||||||
RemoveNodesAccess1712044305787,
|
RemoveNodesAccess1712044305787,
|
||||||
CreateProject1714133768519,
|
CreateProject1714133768519,
|
||||||
|
MakeExecutionStatusNonNullable1714133768521,
|
||||||
];
|
];
|
||||||
|
|||||||
@@ -55,6 +55,7 @@ import { DropRoleMapping1705429061930 } from '../common/1705429061930-DropRoleMa
|
|||||||
import { RemoveFailedExecutionStatus1711018413374 } from '../common/1711018413374-RemoveFailedExecutionStatus';
|
import { RemoveFailedExecutionStatus1711018413374 } from '../common/1711018413374-RemoveFailedExecutionStatus';
|
||||||
import { MoveSshKeysToDatabase1711390882123 } from '../common/1711390882123-MoveSshKeysToDatabase';
|
import { MoveSshKeysToDatabase1711390882123 } from '../common/1711390882123-MoveSshKeysToDatabase';
|
||||||
import { RemoveNodesAccess1712044305787 } from '../common/1712044305787-RemoveNodesAccess';
|
import { RemoveNodesAccess1712044305787 } from '../common/1712044305787-RemoveNodesAccess';
|
||||||
|
import { MakeExecutionStatusNonNullable1714133768521 } from '../common/1714133768521-MakeExecutionStatusNonNullable';
|
||||||
|
|
||||||
export const postgresMigrations: Migration[] = [
|
export const postgresMigrations: Migration[] = [
|
||||||
InitialMigration1587669153312,
|
InitialMigration1587669153312,
|
||||||
@@ -113,4 +114,5 @@ export const postgresMigrations: Migration[] = [
|
|||||||
MoveSshKeysToDatabase1711390882123,
|
MoveSshKeysToDatabase1711390882123,
|
||||||
RemoveNodesAccess1712044305787,
|
RemoveNodesAccess1712044305787,
|
||||||
CreateProject1714133768519,
|
CreateProject1714133768519,
|
||||||
|
MakeExecutionStatusNonNullable1714133768521,
|
||||||
];
|
];
|
||||||
|
|||||||
@@ -53,6 +53,7 @@ import { DropRoleMapping1705429061930 } from './1705429061930-DropRoleMapping';
|
|||||||
import { RemoveFailedExecutionStatus1711018413374 } from '../common/1711018413374-RemoveFailedExecutionStatus';
|
import { RemoveFailedExecutionStatus1711018413374 } from '../common/1711018413374-RemoveFailedExecutionStatus';
|
||||||
import { MoveSshKeysToDatabase1711390882123 } from '../common/1711390882123-MoveSshKeysToDatabase';
|
import { MoveSshKeysToDatabase1711390882123 } from '../common/1711390882123-MoveSshKeysToDatabase';
|
||||||
import { RemoveNodesAccess1712044305787 } from '../common/1712044305787-RemoveNodesAccess';
|
import { RemoveNodesAccess1712044305787 } from '../common/1712044305787-RemoveNodesAccess';
|
||||||
|
import { MakeExecutionStatusNonNullable1714133768521 } from '../common/1714133768521-MakeExecutionStatusNonNullable';
|
||||||
|
|
||||||
const sqliteMigrations: Migration[] = [
|
const sqliteMigrations: Migration[] = [
|
||||||
InitialMigration1588102412422,
|
InitialMigration1588102412422,
|
||||||
@@ -109,6 +110,7 @@ const sqliteMigrations: Migration[] = [
|
|||||||
MoveSshKeysToDatabase1711390882123,
|
MoveSshKeysToDatabase1711390882123,
|
||||||
RemoveNodesAccess1712044305787,
|
RemoveNodesAccess1712044305787,
|
||||||
CreateProject1714133768519,
|
CreateProject1714133768519,
|
||||||
|
MakeExecutionStatusNonNullable1714133768521,
|
||||||
];
|
];
|
||||||
|
|
||||||
export { sqliteMigrations };
|
export { sqliteMigrations };
|
||||||
|
|||||||
@@ -161,6 +161,7 @@ test('should report credential in not recently executed workflow', async () => {
|
|||||||
stoppedAt: date,
|
stoppedAt: date,
|
||||||
workflowId: workflow.id,
|
workflowId: workflow.id,
|
||||||
waitTill: null,
|
waitTill: null,
|
||||||
|
status: 'success',
|
||||||
});
|
});
|
||||||
await Container.get(ExecutionDataRepository).save({
|
await Container.get(ExecutionDataRepository).save({
|
||||||
execution: savedExecution,
|
execution: savedExecution,
|
||||||
@@ -228,6 +229,7 @@ test('should not report credentials in recently executed workflow', async () =>
|
|||||||
stoppedAt: date,
|
stoppedAt: date,
|
||||||
workflowId: workflow.id,
|
workflowId: workflow.id,
|
||||||
waitTill: null,
|
waitTill: null,
|
||||||
|
status: 'success',
|
||||||
});
|
});
|
||||||
|
|
||||||
await Container.get(ExecutionDataRepository).save({
|
await Container.get(ExecutionDataRepository).save({
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ export async function createExecution(
|
|||||||
...(workflow !== undefined && { workflowId: workflow.id }),
|
...(workflow !== undefined && { workflowId: workflow.id }),
|
||||||
stoppedAt: stoppedAt ?? new Date(),
|
stoppedAt: stoppedAt ?? new Date(),
|
||||||
waitTill: waitTill ?? null,
|
waitTill: waitTill ?? null,
|
||||||
status,
|
status: status ?? 'success',
|
||||||
deletedAt,
|
deletedAt,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user