开发者

Sequelize error question

I'm new to node.js and sequelize, and I'm getting an error message maybe someone can help me out with. The problem seems to be with my Sequelize-defined classes: when I call their find or findAll methods, they refuse to access the database:

shell$ node
> var Sequelize = require("sequelize");
> var sequelize = new Sequelize("myapp", "root");
> var User = sequelize.define('User', {开发者_StackOverflow中文版 id: { type: Sequelize.INTEGER, primaryKey: true, autoIncrement: true }, email: Sequelize.STRING, password: Sequelize.STRING });
> User.find(2);
Error: deprecated: use mysql.createClient() instead
    at new Client (/Users/jay/node_modules/sequelize/node_modules/mysql/lib/client.js:12:11)
    at [object Object].run (/Users/jay/node_modules/sequelize/lib/sequelize/query.js:11:16)
    at [object Object].query (/Users/jay/node_modules/sequelize/lib/sequelize/sequelize.js:42:52)
    at [object Object].query (/Users/jay/node_modules/sequelize/lib/sequelize/model-definition.js:67:18)
    at [object Object].find (/Users/jay/node_modules/sequelize/lib/sequelize/model-definition.js:136:15)
    at [object Context]:1:6
    at Interface.<anonymous> (repl.js:171:22)
    at Interface.emit (events.js:64:17)
    at Interface._onLine (readline.js:153:10)
    at Interface._line (readline.js:408:8)

Does anybody know what I'm doing wrong and how to get this thing to work? Thanks.


OK, I just released v1.1.0 which supports node-mysql 0.9.4. Please give it a try and tell me if it works nicely for you.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜