mirror of
https://github.com/jwinterm/nodejs-pool.git
synced 2026-12-03 12:04:04 +01:00
Whoops!
This commit is contained in:
@@ -14,14 +14,16 @@ global.schema = JSON.parse(sql_schema);
|
|||||||
|
|
||||||
let loopCount = 0;
|
let loopCount = 0;
|
||||||
let updatedCount = 0;
|
let updatedCount = 0;
|
||||||
async.eachSeries(global.schema, function(entry){
|
async.eachSeries(global.schema, function(entry, callback){
|
||||||
global.mysql.query("SELECT * FROM config WHERE module = ? AND item = ?", [entry.module, entry.item]).then(function(rows){
|
global.mysql.query("SELECT * FROM config WHERE module = ? AND item = ?", [entry.module, entry.item]).then(function(rows){
|
||||||
loopCount += 1;
|
loopCount += 1;
|
||||||
if (rows.length > 0){
|
if (rows.length > 0){
|
||||||
return;
|
return callback();
|
||||||
}
|
}
|
||||||
updatedCount += 1;
|
updatedCount += 1;
|
||||||
global.mysql.query("INSERT INTO config (module, item, item_value, item_type, Item_desc) VALUES (?, ?, ?, ?, ?)", [entry.module, entry.item, entry.item_value, entry.item_type, entry.Item_desc]);
|
global.mysql.query("INSERT INTO config (module, item, item_value, item_type, Item_desc) VALUES (?, ?, ?, ?, ?)", [entry.module, entry.item, entry.item_value, entry.item_type, entry.Item_desc]).then(function(){
|
||||||
|
return callback();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
}, function(){
|
}, function(){
|
||||||
console.log("Updated SQL schema with "+updatedCount+" new rows! Exiting!");
|
console.log("Updated SQL schema with "+updatedCount+" new rows! Exiting!");
|
||||||
|
|||||||
Reference in New Issue
Block a user