'use strict'; const Sequelize = require('sequelize'); module.exports = function (config) { const defaultConfig = require('../../config').postgres; config = config || defaultConfig; if (config) { let orm = new Sequelize(config.url, config.opts); let dc = { orm, ORM: Sequelize, models: {} }; if (Array.isArray(config.models)) { config.models.forEach(fn => { fn(dc); }); } process.postgres = dc; return dc; } };