diff --git a/lib/transformer.ts b/lib/transformer.ts index 0356d1b..ad11ebe 100755 --- a/lib/transformer.ts +++ b/lib/transformer.ts @@ -203,16 +203,20 @@ export const Transformer = { * @param {Object} app.config.store * @return {Sequelize} Sequelize instance */ - createConnectionsFromConfig (config: {[key: string]: any}) { + createConnectionsFromConfig (app: FabrixApp, config: {[key: string]: any}) { + const logger = function(str) { + app.log.debug(str) + } if (config.uri) { - return new Sequelize(config.uri, Object.assign({}, config)) // Sequelize modify options object + // Sequelize modify options object + return new Sequelize(config.uri, Object.assign({}, config, { logging: logger })) } else { return new Sequelize( config.database, config.username || process.env.POSTGRES_USER, config.password || process.env.POSTGRES_PASSWORD, - config + Object.assign({}, config, { logging: logger }) ) } }, @@ -249,7 +253,7 @@ export const Transformer = { const stores = Transformer.pickStores(app.config.get('stores')) const sequelize = {} Object.keys(stores).forEach(key => { - sequelize[key] = Transformer.createConnectionsFromConfig(stores[key]) + sequelize[key] = Transformer.createConnectionsFromConfig(app, stores[key]) sequelize[key].fabrixApp = app sequelize[key].migrate = stores[key].migrate sequelize[key].models = {} diff --git a/package-lock.json b/package-lock.json index 8d1e015..69b4871 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "@fabrix/spool-sequelize", - "version": "1.1.9", + "version": "1.1.10", "lockfileVersion": 1, "requires": true, "dependencies": { @@ -114,9 +114,9 @@ } }, "@fabrix/fabrix": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/@fabrix/fabrix/-/fabrix-1.1.3.tgz", - "integrity": "sha512-B5KpWcrhLQybEmlaYqRxUE8+rli62+BrlupqA/siJePAjRYs98UmrTmoJaUMVqI4IkJgtwe2TMlXFng1mthhwg==", + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/@fabrix/fabrix/-/fabrix-1.1.4.tgz", + "integrity": "sha512-2bvYZGmtXjPZhNZvoqhxmHR/dU92hcvbwU6aEs6hA9uRFYqdWe8Ar6prWc6y7Q2Lvf/pbtY9/mTYSsJpHXlQow==", "dev": true, "requires": { "lodash": "4.17.10", diff --git a/package.json b/package.json index 23d3e6e..a19bb26 100755 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@fabrix/spool-sequelize", - "version": "1.1.9", + "version": "1.1.10", "description": "Spool - Datastore Spool for Sequelize.js http://sequelizejs.com", "scripts": { "build": "tsc -p ./lib/tsconfig.release.json", @@ -51,7 +51,7 @@ "sequelize": "^4.37.10" }, "devDependencies": { - "@fabrix/fabrix": "^1.1.3", + "@fabrix/fabrix": "^1.1.4", "@fabrix/lint": "^1.0.0-alpha.3", "@fabrix/spool-router": "^1.1.3", "@fabrix/spool-tapestries": "^1.1.3",