最近在用 nodejs 中的 db-migrate npm 实现数据库的版本管理,发现始终报下面这个错误, 没找到原因.
wxianfeng-2:fanqiang wangxianfeng$ db-migrate up
[ERROR] 20130914175153-create-table-users { [Error: ER_PARSE_ERROR: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '?)' at line 1]
code: 'ER_PARSE_ERROR',
errno: 1064,
sqlState: '42000',
index: 0 }
我的迁移文件内容如下:
var dbm = require('db-migrate');
var type = dbm.dataType;
exports.up = function(db, callback) {
db.createTable("users",{
id: { type: 'int', primarykey: true, autoIncrement: true },
email: 'string',
created_at: 'datetime',
updated_at: 'datetime'
},callback)
};
exports.down = function(db, callback) {
};
什么原因呢?