You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

25 lines
561 B

'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;
}
};