fix(plugin-workflow): fix manual migration script (#1735)

This commit is contained in:
Junyi 2023-04-20 16:09:17 +07:00 committed by GitHub
parent 8352f1a7a3
commit edd2ec7fe6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -155,7 +155,7 @@ function migrateUsedConfig(config, manualForms) {
}
return `{{$jobsMapByNodeId.${id}.${manualForms[id]}${path || ''}}}`;
});
} else if (valueType === 'object') {
} else if (valueType === 'object' && config[key]) {
migrateUsedConfig(config[key], manualForms);
}
});
@ -246,7 +246,7 @@ export default class extends Migration {
await usedNodes.reduce((promise, node) => promise.then(async () => {
await node.update({
config: migrateUsedConfig(cloneDeep(node.config), nodeForms)
config: migrateUsedConfig(cloneDeep(node.config ?? {}), nodeForms)
}, {
silent: true,
transaction