Fixed isActual syntax to accept optional model arg

This commit is contained in:
Geoffroy Lesage 2015-01-08 10:29:55 -06:00
parent e00b0ba8cf
commit 9d3ab6fc42
1 changed files with 12 additions and 1 deletions

View File

@ -693,7 +693,18 @@ MySQL.prototype.createTable = function (model, cb) {
*/
MySQL.prototype.isActual = function(models, cb) {
var self = this;
var ok = false;
if ((!cb) && ('function' === typeof models)) {
cb = models;
models = undefined;
}
// First argument is a model name
if ('string' === typeof models) {
models = [models];
}
models = models || Object.keys(this._models);
async.each(Object.keys(models), function(model, done) {
var table = self.tableEscaped(model);
self.query('SHOW FIELDS FROM ' + table, function(err, fields) {