diff --git a/camera.js b/camera.js index df8c9fe0..3c24b3f9 100644 --- a/camera.js +++ b/camera.js @@ -148,15 +148,15 @@ if(config.childNodes.mode !== 'child'){ //add Cloud Videos table, will remove in future s.sqlQuery('CREATE TABLE IF NOT EXISTS `Cloud Videos` (`mid` varchar(50) NOT NULL,`ke` varchar(50) DEFAULT NULL,`href` text NOT NULL,`size` float DEFAULT NULL,`time` timestamp NULL DEFAULT NULL,`end` timestamp NULL DEFAULT NULL,`status` int(1) DEFAULT \'0\' COMMENT \'0:Complete,1:Read,2:Archive\',`details` text) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;',[],function(err){ // if(err)console.log(err) - }) + },true) //create Files table s.sqlQuery('CREATE TABLE IF NOT EXISTS `Files` (`ke` varchar(50) NOT NULL,`mid` varchar(50) NOT NULL,`name` tinytext NOT NULL,`size` float NOT NULL DEFAULT \'0\',`details` text NOT NULL,`status` int(1) NOT NULL DEFAULT \'0\') ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;',[],function(err){ // if(err)console.log(err) - }) + },true) //add time to Files table s.sqlQuery('ALTER TABLE `Files` ADD COLUMN `time` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP AFTER `status`;',[],function(err){ // if(err)console.log(err) - }) + },true) //master node - startup functions setInterval(function(){ s.cpuUsage(function(cpu){ diff --git a/libs/sql.js b/libs/sql.js index b4b1f6cb..9a47e58d 100644 --- a/libs/sql.js +++ b/libs/sql.js @@ -43,7 +43,7 @@ module.exports = function(s,config){ newValue = new Date(value.replace('T',' ')) return newValue } - s.sqlQuery = function(query,values,onMoveOn){ + s.sqlQuery = function(query,values,onMoveOn,hideLog){ if(!values){values=[]} if(typeof values === 'function'){ var onMoveOn = values; @@ -55,7 +55,7 @@ module.exports = function(s,config){ return s.databaseEngine .raw(query,values) .asCallback(function(err,r){ - if(err){ + if(err && !hideLog){ console.log('s.sqlQuery QUERY ERRORED',query) console.log('s.sqlQuery ERROR',err) }