mirror of
https://github.com/jwinterm/nodejs-pool.git
synced 2026-10-17 05:21:27 +02:00
Moving loop counter to inside of the sql select, and adding an extra abort stage.
This commit is contained in:
@@ -14,9 +14,13 @@ global.schema = JSON.parse(sql_schema);
|
||||
let loopCount = 0;
|
||||
let updatedCount = 0;
|
||||
global.schema.forEach(function(entry){
|
||||
loopCount += 1;
|
||||
global.mysql.query("SELECT * FROM config WHERE module = ? AND item = ?", [entry.module, entry.item]).then(function(rows){
|
||||
loopCount += 1;
|
||||
if (rows.length > 0){
|
||||
if(loopCount === global.schema.length){
|
||||
console.log("Updated SQL schema with "+updatedCount+" new rows! Exiting!");
|
||||
process.exit();
|
||||
}
|
||||
return;
|
||||
}
|
||||
updatedCount += 1;
|
||||
|
||||
Reference in New Issue
Block a user