From 48916e2b07869e32bd69a54ede1128ab7adcfa29 Mon Sep 17 00:00:00 2001 From: joan Date: Wed, 7 Sep 2022 11:26:58 +0200 Subject: [PATCH] Debug logs --- back/methods/edi/updateData.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/back/methods/edi/updateData.js b/back/methods/edi/updateData.js index 7f4f0b5e7..b6b06e19f 100644 --- a/back/methods/edi/updateData.js +++ b/back/methods/edi/updateData.js @@ -202,16 +202,20 @@ module.exports = Self => { const baseName = table.fileName; const tx = await Self.beginTransaction({}); - + console.log(`Started transaction`); try { const options = {transaction: tx}; + console.log(`Emptying table ${toTable}...`); const tableName = `edi.${toTable}`; await Self.rawSql(`DELETE FROM ??`, [tableName], options); + console.log(`Reading files...`); const dirFiles = await fs.readdir(tempDir); const files = dirFiles.filter(file => file.startsWith(baseName)); + console.log('Files to import: ' + files.join(', ')); + for (const file of files) { console.log(`Dumping data from file ${file}...`); @@ -228,6 +232,7 @@ module.exports = Self => { } await tx.commit(); + console.log(`Closed transaction`); } catch (error) { await tx.rollback(); throw error;