Disabled transaction
gitea/salix/pipeline/head This commit looks good Details

This commit is contained in:
Joan Sanchez 2022-09-07 12:28:53 +02:00
parent aec053868d
commit ab86ba0652
1 changed files with 8 additions and 7 deletions

View File

@ -202,14 +202,14 @@ module.exports = Self => {
const baseName = table.fileName;
console.log(`Starting transaction...`);
const tx = await Self.beginTransaction({});
// const tx = await Self.beginTransaction({});
console.log(`Started transaction`);
try {
const options = {transaction: tx};
// const options = {transaction: tx};
console.log(`Emptying table ${toTable}...`);
const tableName = `edi.${toTable}`;
await Self.rawSql(`DELETE FROM ??`, [tableName], options);
await Self.rawSql(`DELETE FROM ??`, [tableName]);
console.log(`Reading files...`);
const dirFiles = await fs.readdir(tempDir);
@ -224,18 +224,19 @@ module.exports = Self => {
const sqlTemplate = await fs.readFile(templatePath, 'utf8');
const filePath = path.join(tempDir, file);
await Self.rawSql(sqlTemplate, [filePath], options);
await Self.rawSql(sqlTemplate, [filePath]);
await Self.rawSql(`
UPDATE edi.tableConfig
SET updated = ?
WHERE fileName = ?
`, [new Date(), baseName], options);
`, [new Date(), baseName]);
}
await tx.commit();
// await tx.commit();
console.log(`Closed transaction`);
} catch (error) {
await tx.rollback();
// await tx.rollback();
console.log(error);
throw error;
}
console.log(`Updated table ${toTable}\n`);