mirror of
https://github.com/Ylianst/MeshCentral.git
synced 2024-11-22 22:17:31 +03:00
fix nedb to sqlite migrate
This commit is contained in:
parent
7ea744fdfe
commit
23c2627b3b
10
db.js
10
db.js
@ -1470,7 +1470,14 @@ module.exports.CreateDB = function (parent, func) {
|
|||||||
obj.StoreEvent = function (event, func) {
|
obj.StoreEvent = function (event, func) {
|
||||||
obj.dbCounters.eventsSet++;
|
obj.dbCounters.eventsSet++;
|
||||||
sqlDbQuery('INSERT INTO events VALUES (NULL, $1, $2, $3, $4, $5, $6) RETURNING id', [event.time, ((typeof event.domain == 'string') ? event.domain : null), event.action, event.nodeid ? event.nodeid : null, event.userid ? event.userid : null, JSON.stringify(event)], function (err, docs) {
|
sqlDbQuery('INSERT INTO events VALUES (NULL, $1, $2, $3, $4, $5, $6) RETURNING id', [event.time, ((typeof event.domain == 'string') ? event.domain : null), event.action, event.nodeid ? event.nodeid : null, event.userid ? event.userid : null, JSON.stringify(event)], function (err, docs) {
|
||||||
if ((err == null) && (docs[0].id)) { for (var i in event.ids) { if (event.ids[i] != '*') { sqlDbQuery('INSERT INTO eventids VALUES ($1, $2)', [docs[0].id, event.ids[i]]); } } }
|
if(func){ func(); }
|
||||||
|
if ((err == null) && (docs[0].id)) {
|
||||||
|
for (var i in event.ids) {
|
||||||
|
if (event.ids[i] != '*') {
|
||||||
|
sqlDbQuery('INSERT INTO eventids VALUES ($1, $2)', [docs[0].id, event.ids[i]], function(){ if(func){ func(); } });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
obj.GetEvents = function (ids, domain, func) {
|
obj.GetEvents = function (ids, domain, func) {
|
||||||
@ -3239,6 +3246,7 @@ module.exports.CreateDB = function (parent, func) {
|
|||||||
for (var i in docs) {
|
for (var i in docs) {
|
||||||
pendingTransfer++;
|
pendingTransfer++;
|
||||||
eventRecordsTransferCount++;
|
eventRecordsTransferCount++;
|
||||||
|
for (var b in docs[i].ids) { if (docs[i].ids[b] != '*') { pendingTransfer++; } }
|
||||||
obj.StoreEvent(docs[i], function () { pendingTransfer--; });
|
obj.StoreEvent(docs[i], function () { pendingTransfer--; });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user