Skip to content

Commit

Permalink
fix(graph): Add migration fix for missing flows field
Browse files Browse the repository at this point in the history
Handle edge case in graph migration where flows field is missing in v2024-12-10
graphs by deriving flows from existing graph data. This prevents migration
failures for older graph versions.
  • Loading branch information
toyamarinyon committed Jan 6, 2025
1 parent 460c9a9 commit 5ee9816
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions packages/lib/graph.ts
Original file line number Diff line number Diff line change
Expand Up @@ -341,6 +341,16 @@ export function migrateGraph(graph: Graph): Graph {
};
}

// fix for migration issue
if (newGraph.version === "2024-12-10" && !("flows" in newGraph)) {
newGraph = {
// @ts-ignore: Old graph has no flows field
...newGraph,
// @ts-ignore: Old graph has no flows field
flows: deriveFlows({ ...newGraph, flows: [] }),
};
}

if (
newGraph.version === "2024-12-10" ||
newGraph.version === "2024-12-11" ||
Expand Down

0 comments on commit 5ee9816

Please sign in to comment.