1
0
Fork 0
mirror of https://github.com/Ylianst/MeshCentral.git synced 2025-03-09 15:40:18 +00:00

Fixed mtype not being a number type in database.

This commit is contained in:
Ylian Saint-Hilaire 2020-12-28 23:33:08 -08:00
parent 8fc23995b9
commit 0769185831
4 changed files with 13 additions and 4 deletions

9
db.js
View file

@ -101,7 +101,14 @@ module.exports.CreateDB = function (parent, func) {
obj.GetAllType('mesh', function (err, docs) {
if (err != null) { parent.debug('db', 'ERROR (GetAll mesh): ' + err); }
var meshlist = [];
if ((err == null) && (docs.length > 0)) { for (var i in docs) { meshlist.push(docs[i]._id); } }
if ((err == null) && (docs.length > 0)) {
for (var i in docs) {
meshlist.push(docs[i]._id);
// Make sure all mesh types are number type, if not, fix it.
if (typeof docs[i].mtype == 'string') { docs[i].mtype = parseInt(docs[i].mtype); obj.Set(docs[i]); }
}
}
if ((obj.databaseType == 4) || (obj.databaseType == 5)) {
// MariaDB
sqlDbQuery('DELETE FROM MeshCentral.Main WHERE (extra LIKE ("mesh/%") AND (extra NOT IN ?)', [meshlist], func);