Disabled transaction
gitea/salix/pipeline/head This commit looks good
Details
gitea/salix/pipeline/head This commit looks good
Details
This commit is contained in:
parent
aec053868d
commit
ab86ba0652
|
@ -202,14 +202,14 @@ module.exports = Self => {
|
||||||
const baseName = table.fileName;
|
const baseName = table.fileName;
|
||||||
|
|
||||||
console.log(`Starting transaction...`);
|
console.log(`Starting transaction...`);
|
||||||
const tx = await Self.beginTransaction({});
|
// const tx = await Self.beginTransaction({});
|
||||||
console.log(`Started transaction`);
|
console.log(`Started transaction`);
|
||||||
try {
|
try {
|
||||||
const options = {transaction: tx};
|
// const options = {transaction: tx};
|
||||||
|
|
||||||
console.log(`Emptying table ${toTable}...`);
|
console.log(`Emptying table ${toTable}...`);
|
||||||
const tableName = `edi.${toTable}`;
|
const tableName = `edi.${toTable}`;
|
||||||
await Self.rawSql(`DELETE FROM ??`, [tableName], options);
|
await Self.rawSql(`DELETE FROM ??`, [tableName]);
|
||||||
|
|
||||||
console.log(`Reading files...`);
|
console.log(`Reading files...`);
|
||||||
const dirFiles = await fs.readdir(tempDir);
|
const dirFiles = await fs.readdir(tempDir);
|
||||||
|
@ -224,18 +224,19 @@ module.exports = Self => {
|
||||||
const sqlTemplate = await fs.readFile(templatePath, 'utf8');
|
const sqlTemplate = await fs.readFile(templatePath, 'utf8');
|
||||||
const filePath = path.join(tempDir, file);
|
const filePath = path.join(tempDir, file);
|
||||||
|
|
||||||
await Self.rawSql(sqlTemplate, [filePath], options);
|
await Self.rawSql(sqlTemplate, [filePath]);
|
||||||
await Self.rawSql(`
|
await Self.rawSql(`
|
||||||
UPDATE edi.tableConfig
|
UPDATE edi.tableConfig
|
||||||
SET updated = ?
|
SET updated = ?
|
||||||
WHERE fileName = ?
|
WHERE fileName = ?
|
||||||
`, [new Date(), baseName], options);
|
`, [new Date(), baseName]);
|
||||||
}
|
}
|
||||||
|
|
||||||
await tx.commit();
|
// await tx.commit();
|
||||||
console.log(`Closed transaction`);
|
console.log(`Closed transaction`);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
await tx.rollback();
|
// await tx.rollback();
|
||||||
|
console.log(error);
|
||||||
throw error;
|
throw error;
|
||||||
}
|
}
|
||||||
console.log(`Updated table ${toTable}\n`);
|
console.log(`Updated table ${toTable}\n`);
|
||||||
|
|
Loading…
Reference in New Issue