Merge pull request #63 from glesage/feature/fix-isActual
Fixed isActual implemenation
This commit is contained in:
commit
aa157b1050
17
lib/mysql.js
17
lib/mysql.js
|
@ -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 {String[]} [models] A model name or an array of model names. If not present, apply to all models
|
||||||
* @param {Function} [cb] The callback function
|
* @param {Function} [cb] The callback function
|
||||||
*/
|
*/
|
||||||
MySQL.prototype.isActual = function(cb) {
|
MySQL.prototype.isActual = function(models, cb) {
|
||||||
var self = this;
|
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);
|
var table = self.tableEscaped(model);
|
||||||
self.query('SHOW FIELDS FROM ' + table, function(err, fields) {
|
self.query('SHOW FIELDS FROM ' + table, function(err, fields) {
|
||||||
self.query('SHOW INDEXES FROM ' + table, function(err, indexes) {
|
self.query('SHOW INDEXES FROM ' + table, function(err, indexes) {
|
||||||
|
|
Loading…
Reference in New Issue