Debug logs
gitea/salix/pipeline/head Something is wrong with the build of this commit Details

This commit is contained in:
Joan Sanchez 2022-09-07 11:26:58 +02:00
parent 8f86cacc96
commit 48916e2b07
1 changed files with 6 additions and 1 deletions

View File

@ -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;