express 数据库迁移文件 db-migrate 有人用吗?
 发布于 12 年前  作者 wxianfeng  5998 次预览  最后一次回复是 12 年前  来自  

最近在用 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) {
};

什么原因呢?

1 回复
we2code

没有用过,不过一般碰到这种情况可以看看执行的SQL具体是什么