add check for arr

This commit is contained in:
Mutasem 2022-08-04 11:27:37 +02:00
parent 43a91b8bd3
commit 40a43f5957
3 changed files with 22 additions and 0 deletions

View file

@ -20,6 +20,9 @@ export class AddNodeIds1658932910559 implements MigrationInterface {
await runChunked(queryRunner, workflowsQuery, (workflows) => {
workflows.forEach(async (workflow) => {
const nodes = workflow.nodes;
if (!Array.isArray(nodes)) {
return;
}
// @ts-ignore
nodes.forEach((node) => {
if (!node.id) {
@ -55,6 +58,9 @@ export class AddNodeIds1658932910559 implements MigrationInterface {
await runChunked(queryRunner, workflowsQuery, (workflows) => {
workflows.forEach(async (workflow) => {
const nodes = workflow.nodes;
if (!Array.isArray(nodes)) {
return;
}
// @ts-ignore
nodes.forEach((node) => delete node.id );

View file

@ -26,6 +26,10 @@ export class AddNodeIds1658932090381 implements MigrationInterface {
await runChunked(queryRunner, workflowsQuery, (workflows) => {
workflows.forEach(async (workflow) => {
const nodes = workflow.nodes;
if (!Array.isArray(nodes)) {
return;
}
// @ts-ignore
nodes.forEach((node) => {
if (!node.id) {
@ -67,6 +71,10 @@ export class AddNodeIds1658932090381 implements MigrationInterface {
await runChunked(queryRunner, workflowsQuery, (workflows) => {
workflows.forEach(async (workflow) => {
const nodes = workflow.nodes;
if (!Array.isArray(nodes)) {
return;
}
// @ts-ignore
nodes.forEach((node) => delete node.id );

View file

@ -24,6 +24,10 @@ export class AddNodeIds1658930531669 implements MigrationInterface {
await runChunked(queryRunner, workflowsQuery, (workflows) => {
workflows.forEach(async (workflow) => {
const nodes = JSON.parse(workflow.nodes);
if (!Array.isArray(nodes)) {
return;
}
nodes.forEach((node: INode) => {
if (!node.id) {
node.id = uuid();
@ -61,6 +65,10 @@ export class AddNodeIds1658930531669 implements MigrationInterface {
await runChunked(queryRunner, workflowsQuery, (workflows) => {
workflows.forEach(async (workflow) => {
const nodes = JSON.parse(workflow.nodes);
if (!Array.isArray(nodes)) {
return;
}
// @ts-ignore
nodes.forEach((node) => delete node.id );