diff --git a/engine/db/add.js b/engine/db/add.js index a480908..f9d527f 100644 --- a/engine/db/add.js +++ b/engine/db/add.js @@ -42,7 +42,10 @@ module.exports = async function add({ dbFullName, tableName, data, tableSchema, /** * Handle function logic */ + if (duplicateColumnName && typeof duplicateColumnName === "string") { + console.log("duplicateColumnName", duplicateColumnName); + const duplicateValue = await handler({ queryString: `SELECT * FROM \`${tableName}\` WHERE \`${duplicateColumnName}\`=?`, queryValuesArray: [duplicateColumnValue], @@ -69,19 +72,6 @@ module.exports = async function add({ dbFullName, tableName, data, tableSchema, encryptionSalt, }); } - } else if (duplicateColumnName && typeof duplicateColumnName === "object" && duplicateColumnValue && typeof duplicateColumnValue === "object") { - const duplicateArray = duplicateColumnName.map((dupColName, index) => { - return `\`${dupColName}\`='${duplicateColumnValue[index]}'`; - }); - - const duplicateValue = await handler({ - queryString: `SELECT * FROM ${tableName} WHERE ${duplicateArray.join(" AND ")}`, - database: dbFullName, - }); - - if (duplicateValue && duplicateValue[0] && !update) { - return null; - } } /** diff --git a/package.json b/package.json index d153141..d8877ba 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "datasquirel", - "version": "1.1.68", + "version": "1.1.69", "description": "Cloud-based SQL data management tool", "main": "index.js", "scripts": {