fix(core): Fix named parameter resolution in migrations (#7688)
Fixes #7628
This commit is contained in:
committed by
GitHub
parent
91c3ea87fe
commit
4441ed5116
@@ -20,11 +20,10 @@ export class UniqueWorkflowNames1620821879465 implements ReversibleMigration {
|
||||
await Promise.all(
|
||||
duplicates.map(async (workflow, index) => {
|
||||
if (index === 0) return;
|
||||
return runQuery(
|
||||
`UPDATE ${tableName} SET name = :name WHERE id = :id`,
|
||||
{ name: `${workflow.name} ${index + 1}` },
|
||||
{ id: workflow.id },
|
||||
);
|
||||
return runQuery(`UPDATE ${tableName} SET name = :name WHERE id = :id`, {
|
||||
name: `${workflow.name} ${index + 1}`,
|
||||
id: workflow.id,
|
||||
});
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -42,11 +42,10 @@ export class UpdateWorkflowCredentials1630330987096 implements ReversibleMigrati
|
||||
}
|
||||
});
|
||||
if (credentialsUpdated) {
|
||||
await runQuery(
|
||||
`UPDATE ${workflowsTable} SET nodes = :nodes WHERE id = :id`,
|
||||
{ nodes: JSON.stringify(nodes) },
|
||||
{ id: workflow.id },
|
||||
);
|
||||
await runQuery(`UPDATE ${workflowsTable} SET nodes = :nodes WHERE id = :id`, {
|
||||
nodes: JSON.stringify(nodes),
|
||||
id: workflow.id,
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
@@ -79,8 +78,7 @@ export class UpdateWorkflowCredentials1630330987096 implements ReversibleMigrati
|
||||
await runQuery(
|
||||
`UPDATE ${executionsTable}
|
||||
SET ${escape.columnName('workflowData')} = :data WHERE id = :id`,
|
||||
{ data: JSON.stringify(workflowData) },
|
||||
{ id: execution.id },
|
||||
{ data: JSON.stringify(workflowData), id: execution.id },
|
||||
);
|
||||
}
|
||||
});
|
||||
@@ -114,8 +112,7 @@ export class UpdateWorkflowCredentials1630330987096 implements ReversibleMigrati
|
||||
await runQuery(
|
||||
`UPDATE ${executionsTable}
|
||||
SET ${escape.columnName('workflowData')} = :data WHERE id = :id`,
|
||||
{ data: JSON.stringify(workflowData) },
|
||||
{ id: execution.id },
|
||||
{ data: JSON.stringify(workflowData), id: execution.id },
|
||||
);
|
||||
}
|
||||
});
|
||||
@@ -160,11 +157,10 @@ export class UpdateWorkflowCredentials1630330987096 implements ReversibleMigrati
|
||||
}
|
||||
});
|
||||
if (credentialsUpdated) {
|
||||
await runQuery(
|
||||
`UPDATE ${workflowsTable} SET nodes = :nodes WHERE id = :id`,
|
||||
{ nodes: JSON.stringify(nodes) },
|
||||
{ id: workflow.id },
|
||||
);
|
||||
await runQuery(`UPDATE ${workflowsTable} SET nodes = :nodes WHERE id = :id`, {
|
||||
nodes: JSON.stringify(nodes),
|
||||
id: workflow.id,
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
@@ -206,8 +202,7 @@ export class UpdateWorkflowCredentials1630330987096 implements ReversibleMigrati
|
||||
await runQuery(
|
||||
`UPDATE ${executionsTable}
|
||||
SET ${escape.columnName('workflowData')} = :data WHERE id = :id`,
|
||||
{ data: JSON.stringify(workflowData) },
|
||||
{ id: execution.id },
|
||||
{ data: JSON.stringify(workflowData), id: execution.id },
|
||||
);
|
||||
}
|
||||
});
|
||||
@@ -249,8 +244,7 @@ export class UpdateWorkflowCredentials1630330987096 implements ReversibleMigrati
|
||||
await runQuery(
|
||||
`UPDATE ${executionsTable}
|
||||
SET ${escape.columnName('workflowData')} = :data WHERE id = :id`,
|
||||
{ data: JSON.stringify(workflowData) },
|
||||
{ id: execution.id },
|
||||
{ data: JSON.stringify(workflowData), id: execution.id },
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -18,11 +18,10 @@ export class AddNodeIds1658930531669 implements ReversibleMigration {
|
||||
}
|
||||
});
|
||||
|
||||
await runQuery(
|
||||
`UPDATE ${tableName} SET nodes = :nodes WHERE id = :id`,
|
||||
{ nodes: JSON.stringify(nodes) },
|
||||
{ id: workflow.id },
|
||||
);
|
||||
await runQuery(`UPDATE ${tableName} SET nodes = :nodes WHERE id = :id`, {
|
||||
nodes: JSON.stringify(nodes),
|
||||
id: workflow.id,
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
@@ -33,11 +32,10 @@ export class AddNodeIds1658930531669 implements ReversibleMigration {
|
||||
await runInBatches<Workflow>(workflowsQuery, async (workflows) => {
|
||||
workflows.forEach(async (workflow) => {
|
||||
const nodes = parseJson(workflow.nodes).map(({ id, ...rest }) => rest);
|
||||
await runQuery(
|
||||
`UPDATE ${tableName} SET nodes = :nodes WHERE id = :id`,
|
||||
{ nodes: JSON.stringify(nodes) },
|
||||
{ id: workflow.id },
|
||||
);
|
||||
await runQuery(`UPDATE ${tableName} SET nodes = :nodes WHERE id = :id`, {
|
||||
nodes: JSON.stringify(nodes),
|
||||
id: workflow.id,
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
@@ -12,11 +12,10 @@ export class AddWorkflowVersionIdColumn1669739707124 implements ReversibleMigrat
|
||||
|
||||
const workflowIds: Workflow[] = await runQuery(`SELECT id FROM ${tableName}`);
|
||||
for (const { id } of workflowIds) {
|
||||
await runQuery(
|
||||
`UPDATE ${tableName} SET ${columnName} = :versionId WHERE id = :id`,
|
||||
{ versionId: uuidv4() },
|
||||
{ id },
|
||||
);
|
||||
await runQuery(`UPDATE ${tableName} SET ${columnName} = :versionId WHERE id = :id`, {
|
||||
versionId: uuidv4(),
|
||||
id,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -47,11 +47,10 @@ export class PurgeInvalidWorkflowConnections1675940580449 implements Irreversibl
|
||||
});
|
||||
|
||||
// Update database with new connections
|
||||
return runQuery(
|
||||
`UPDATE ${workflowsTable} SET connections = :connections WHERE id = :id`,
|
||||
{ connections: JSON.stringify(connections) },
|
||||
{ id: workflow.id },
|
||||
);
|
||||
return runQuery(`UPDATE ${workflowsTable} SET connections = :connections WHERE id = :id`, {
|
||||
connections: JSON.stringify(connections),
|
||||
id: workflow.id,
|
||||
});
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user