generated from container/tmpl
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.
24 lines
561 B
24 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;
|
|
}
|
|
};
|
|
|