Merge pull request #63 from glesage/feature/fix-isActual

Fixed isActual implemenation
This commit is contained in:
Raymond Feng 2015-01-14 14:49:24 -08:00
commit aa157b1050
1 changed files with 14 additions and 3 deletions

View File

@ -690,10 +690,21 @@ MySQL.prototype.createTable = function (model, cb) {
* @param {String[]} [models] A model name or an array of model names. If not present, apply to all models
* @param {Function} [cb] The callback function
*/
MySQL.prototype.isActual = function(cb) {
MySQL.prototype.isActual = function(models, cb) {
var self = this;
var ok = false;
async.each(Object.keys(this._models), function(model, done) {
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) {
self.query('SHOW INDEXES FROM ' + table, function(err, indexes) {