Skip to content

Commit 7a1908f

Browse files
authored
Only accepts SQL store
When SQL & MongoDB stores are together then It sequelize fires error that MongoDB dialect not supported. So check only SQL stores from config to work sequelize & mongoose together.
1 parent c99b2c1 commit 7a1908f

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

lib/transformer.js

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,12 +48,23 @@ module.exports = {
4848
return new Sequelize(config.database, config.username, config.password, config)
4949
}
5050
},
51+
52+
/**
53+
* Pick only SQL stores from app config
54+
* @param {Object} stores
55+
* @return {Object}
56+
*/
57+
pickStores (stores) {
58+
return _.pickBy(stores, (_store, name) => {
59+
return (_store.dialect && _.isString(_store.dialect))
60+
})
61+
},
5162

5263
/**
5364
* Transform the Trails.js "stores" config into a Sequelize object
5465
*/
5566
transformStores (app) {
56-
const stores = app.config.database.stores
67+
const stores = this.pickStores(app.config.database.stores)
5768
const sequelize = {}
5869
Object.keys(stores).forEach(key => {
5970
sequelize[key] = this.createFromConfig(stores[key])

0 commit comments

Comments
 (0)