From fc03f21440186b1adc69afb099bf57bf88f4e6d1 Mon Sep 17 00:00:00 2001 From: mit-27 Date: Thu, 20 Jun 2024 03:56:14 -0400 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20Update=20connectorUpdate?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/api/scripts/connectorUpdate.js | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/packages/api/scripts/connectorUpdate.js b/packages/api/scripts/connectorUpdate.js index f993135ad..37d7eb6f2 100755 --- a/packages/api/scripts/connectorUpdate.js +++ b/packages/api/scripts/connectorUpdate.js @@ -328,7 +328,7 @@ function updateInitSQLFile(initSQLFile, newServiceDirs, vertical) { let newLines = newServiceDirs .map((serviceName) => { const columnName = `${vertical.toLowerCase()}_${serviceName.toLowerCase()}`; - return ` ${columnName} boolean NOT NULL,\n`; + return ` ${columnName} boolean,\n`; }) .join(''); @@ -376,10 +376,13 @@ function updateSeedSQLFile(seedSQLFile, newServiceDirs, vertical) { fileContent = fileContent.replace(lastMatch[1], newColumnsSection); // Update each VALUES section - fileContent = fileContent.replace(/VALUES(.*?);/gs, (match) => { + fileContent = fileContent.replace(/INSERT INTO connector_sets \(([^)]+)\) VALUES(.*?);/gs, (match) => { return match .replace(/\),\s*\(/g, '),\n (') // Fix line formatting - .replace(/\([^\)]+\)/g, (values) => { + .replace(/\([^\)]+\)/g, (values, index) => { + if (values.startsWith('(id_connector_set')) { + return values + } let newValues = newColumns.map(() => 'TRUE').join(', '); return values.slice(0, -1) + ', ' + newValues + ')'; }); @@ -439,13 +442,13 @@ function updateObjectTypes(baseDir, objectType, vertical) { updateModuleFile(moduleFile, newServiceDirs, servicesDir); // Path to the mappings file - const mappingsFile = path.join( - __dirname, - `../src/${vertical}/${objectType.toLowerCase()}/types/mappingsTypes.ts`, - ); + // const mappingsFile = path.join( + // __dirname, + // `../src/${vertical}/${objectType.toLowerCase()}/types/mappingsTypes.ts`, + // ); - // Call updateMappingsFile to update the mappings file with new services - updateMappingsFile(mappingsFile, newServiceDirs, objectType, vertical); + // // Call updateMappingsFile to update the mappings file with new services + // updateMappingsFile(mappingsFile, newServiceDirs, objectType, vertical); const possibleProviderForImportStatements = getProvidersForImportStatements( targetFile,