lib/db.js
function runQuery(connection, query, options, done) {
  options = _.isObject(options) ? options :
    connection.QueryTypes[options] ? { type: connection.QueryTypes[options] } : {};

  connection.query(query, options)
    .then(function(results) {
      done(null, results);
    })
    .catch(function(error) {
      if (error) {
        output.error("Query error.  SQL has been written to .tables.debug.  Use a smaller batchSize to more easily find the issue.");
        output.error(error);
        fs.writeFileSync(".tables.debug", query);
      }

      done(error);
    });
}
function runQuery(connection, query, options, done) {
  options = _.isObject(options) ? options :
    connection.QueryTypes[options] ? { type: connection.QueryTypes[options] } : {};

  connection.query(query, options)
    .then(function(results) {
      done(null, results);
    })
    .catch(function(error) {
      if (error) {
        output.error("Query error.  SQL has been written to .tables.debug.  Use a smaller batchSize to more easily find the issue.");
        output.error(error);
        fs.writeFileSync(".tables.debug", query);
      }

      done(error);
    });
}
function runQuery ( connection , query , options , done ) { options = _ . isObject ( options ) ? options : connection . QueryTypes [ options ] ? { type : connection . QueryTypes [ options ] } : { } ; connection . query ( query , options ) . then ( function ( results ) { done ( null , results ) ; } ) . catch ( function ( error ) { if ( error ) { output . error ( "Query error.  SQL has been written to .tables.debug.  Use a smaller batchSize to more easily find the issue." ) ; output . error ( error ) ; fs . writeFileSync ( ".tables.debug" , query ) ; } done ( error ) ; } ) ; }
Queue-ify db query
Queue - ify db query