Debug logs
gitea/salix/pipeline/head Something is wrong with the build of this commit
Details
gitea/salix/pipeline/head Something is wrong with the build of this commit
Details
This commit is contained in:
parent
8f86cacc96
commit
48916e2b07
|
@ -202,16 +202,20 @@ module.exports = Self => {
|
||||||
const baseName = table.fileName;
|
const baseName = table.fileName;
|
||||||
|
|
||||||
const tx = await Self.beginTransaction({});
|
const tx = await Self.beginTransaction({});
|
||||||
|
console.log(`Started transaction`);
|
||||||
try {
|
try {
|
||||||
const options = {transaction: tx};
|
const options = {transaction: tx};
|
||||||
|
|
||||||
|
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], options);
|
||||||
|
|
||||||
|
console.log(`Reading files...`);
|
||||||
const dirFiles = await fs.readdir(tempDir);
|
const dirFiles = await fs.readdir(tempDir);
|
||||||
const files = dirFiles.filter(file => file.startsWith(baseName));
|
const files = dirFiles.filter(file => file.startsWith(baseName));
|
||||||
|
|
||||||
|
console.log('Files to import: ' + files.join(', '));
|
||||||
|
|
||||||
for (const file of files) {
|
for (const file of files) {
|
||||||
console.log(`Dumping data from file ${file}...`);
|
console.log(`Dumping data from file ${file}...`);
|
||||||
|
|
||||||
|
@ -228,6 +232,7 @@ module.exports = Self => {
|
||||||
}
|
}
|
||||||
|
|
||||||
await tx.commit();
|
await tx.commit();
|
||||||
|
console.log(`Closed transaction`);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
await tx.rollback();
|
await tx.rollback();
|
||||||
throw error;
|
throw error;
|
||||||
|
|
Loading…
Reference in New Issue