greenlock-store-sequelize.js/sync.js

23 lines
403 B
JavaScript
Raw Normal View History

'use strict';
2019-04-20 22:02:45 +00:00
function sync(db) {
var keys = Object.keys(db);
function next() {
var modelName = keys.shift();
if (!modelName) { return; }
if (isModel(modelName)) {
return db[modelName].sync().then(next);
}
return next();
}
return Promise.resolve().then(next);
}
function isModel(key) {
return !(['sequelize','Sequelize'].includes(key));
}
2019-04-20 22:02:45 +00:00
module.exports = sync;