使用postgres的sequelize默认为mysql

时间:2014-08-28 19:08:30

标签: node.js postgresql sequelize.js

我正在设置Sequelize来管理Node.js应用中的postgres。

我需要sequelize-postgres,以及在实例化一个新的Sequelize对象时在方言attr中声明'postgres'。但由于某种原因,它默认使用mysql。

确切的错误消息:

/Users/...project/node_modules/sequelize/lib/dialects/mysql/connector-manager.js:306
    var connection = mysql.createConnection(connectionConfig);
                           ^
TypeError: Cannot call method 'createConnection' of undefined
    at module.exports.connect (.../node_modules/sequelize/lib/dialects/mysql/connector-manager.js:306:28)
    at Object.pool.Pooling.Pool.create 

(.../node_modules/sequelize/lib/dialects/mysql/connector-manager.js:131:19)
    at createResource (.../node_modules/sequelize/node_modules/generic-pool/lib/generic-pool.js:258:13)
    at dispense (.../node_modules/sequelize/node_modules/generic-pool/lib/generic-pool.js:250:9)
    at Object.me.acquire (.../node_modules/sequelize/node_modules/generic-pool/lib/generic-pool.js:316:5)
    at null.fct (.../node_modules/sequelize/lib/dialects/mysql/connector-manager.js:241:19)
    at null.<anonymous> (.../node_modules/sequelize/lib/emitters/custom-event-emitter.js:24:18)
    at processImmediate [as _immediateCallback] (timers.js:336:15)

感谢任何帮助,谢谢!

0 个答案:

没有答案