Add nextStepIds to trigger (#13413)

We will have floating steps in our workflow with the branch design.
Currently, a step without parent is considered linked to the trigger. We
need to distinguish the 2 cases. Thus this PR:
- add `nextStepIds` to workflowVersion.trigger
- create a command to migrate existing triggers
This commit is contained in:
martmull
2025-07-24 16:31:10 +02:00
committed by GitHub
parent 7ee250efe7
commit 099694411c
4 changed files with 113 additions and 10 deletions
@@ -32,6 +32,7 @@ import { TwentyORMGlobalManager } from 'src/engine/twenty-orm/twenty-orm-global.
import { SyncWorkspaceMetadataCommand } from 'src/engine/workspace-manager/workspace-sync-metadata/commands/sync-workspace-metadata.command';
import { compareVersionMajorAndMinor } from 'src/utils/version/compare-version-minor-and-major';
import { RemoveWorkflowRunsWithoutState } from 'src/database/commands/upgrade-version-command/1-2/1-2-remove-workflow-runs-without-state.command';
import { AddNextStepIdsToWorkflowVersionTriggers } from 'src/database/commands/upgrade-version-command/1-2/1-2-add-next-step-ids-to-workflow-version-triggers.command';
const execPromise = promisify(exec);
@@ -151,6 +152,7 @@ export class UpgradeCommand extends UpgradeCommandRunner {
// 1.2 Commands
protected readonly removeWorkflowRunsWithoutState: RemoveWorkflowRunsWithoutState,
protected readonly addNextStepIdsToWorkflowVersionTriggers: AddNextStepIdsToWorkflowVersionTriggers,
// 1.3 Commands
) {
@@ -204,7 +206,10 @@ export class UpgradeCommand extends UpgradeCommandRunner {
};
const commands_120: VersionCommands = {
beforeSyncMetadata: [this.removeWorkflowRunsWithoutState],
beforeSyncMetadata: [
this.removeWorkflowRunsWithoutState,
this.addNextStepIdsToWorkflowVersionTriggers,
],
afterSyncMetadata: [],
};