From 9e25a45090d9d1e47d085e2a57110012ca05a693 Mon Sep 17 00:00:00 2001 From: Jan Prochazka Date: Thu, 28 Apr 2022 14:43:04 +0200 Subject: [PATCH] import simplify/fix --- packages/web/src/impexp/createImpExpScript.ts | 46 +++++++++---------- 1 file changed, 21 insertions(+), 25 deletions(-) diff --git a/packages/web/src/impexp/createImpExpScript.ts b/packages/web/src/impexp/createImpExpScript.ts index 5e8f5194..5ea6c3b4 100644 --- a/packages/web/src/impexp/createImpExpScript.ts +++ b/packages/web/src/impexp/createImpExpScript.ts @@ -123,6 +123,11 @@ function getFlagsFroAction(action) { createIfNotExists: true, truncate: true, }; + case 'appendData': + return { + createIfNotExists: false, + truncate: false, + }; } return { @@ -237,32 +242,23 @@ export default async function createImpExpScript(extensions, values, addEditorIn export function getActionOptions(extensions, source, values, targetDbinfo) { const res = []; - const targetName = getTargetName(extensions, source, values); if (values.targetStorageType == 'database') { - let existing = findObjectLike( - { schemaName: values.targetSchemaName, pureName: targetName }, - targetDbinfo, - 'tables' - ); - if (existing) { - res.push({ - label: 'Append data', - value: 'appendData', - }); - res.push({ - label: 'Truncate and import', - value: 'truncate', - }); - res.push({ - label: 'Drop and create table', - value: 'dropCreateTable', - }); - } else { - res.push({ - label: 'Create table', - value: 'createTable', - }); - } + res.push({ + label: 'Create table/append', + value: 'createTable', + }); + res.push({ + label: 'Append data', + value: 'appendData', + }); + res.push({ + label: 'Truncate and import', + value: 'truncate', + }); + res.push({ + label: 'Drop and create table', + value: 'dropCreateTable', + }); } else { res.push({ label: 'Create file',