Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

db-migrate up throw ER_PARSE_ERROR #128

Closed
wxianfeng opened this issue Sep 20, 2013 · 4 comments
Closed

db-migrate up throw ER_PARSE_ERROR #128

wxianfeng opened this issue Sep 20, 2013 · 4 comments

Comments

@wxianfeng
Copy link

hi all
my migrate file like this:

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) {
};

when i run db-migrate up
throw this error, ER_PARSE_ERROR

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 }

then, i see my mysql db, users table has created, but migrations table has no any data.

then i run db-migrate up agin, meet error as follow, tell me users already exists

wxianfeng-2:fanqiang wangxianfeng$ db-migrate up
[ERROR] Error: ER_TABLE_EXISTS_ERROR: Table 'users' already exists
    at Query.Sequence._packetToError (/data/nodejs/fanqiang/node_modules/db-migrate/node_modules/mysql/lib/protocol/sequences/Sequence.js:32:14)
    at Query.ErrorPacket (/data/nodejs/fanqiang/node_modules/db-migrate/node_modules/mysql/lib/protocol/sequences/Query.js:82:18)
    at Protocol._parsePacket (/data/nodejs/fanqiang/node_modules/db-migrate/node_modules/mysql/lib/protocol/Protocol.js:172:24)
    at Parser.write (/data/nodejs/fanqiang/node_modules/db-migrate/node_modules/mysql/lib/protocol/Parser.js:62:12)
    at Protocol.write (/data/nodejs/fanqiang/node_modules/db-migrate/node_modules/mysql/lib/protocol/Protocol.js:37:16)
    at Socket.ondata (stream.js:38:26)
    at Socket.EventEmitter.emit (events.js:126:20)
    at TCP.onread (net.js:396:14)

what problem? pls help me, thanks.

@fschwiet
Copy link

I'm having the same issue too, in one project. Another project uses db-migrate fine with the same initial migration. The working project had db-migrate version 0.5.4, the failing version had 0.6.0. I changed the failing project to use 0.5.4 and it started working without error.

@kunklejr
Copy link
Contributor

Fixed in v0.6.1

@fschwiet
Copy link

Confirmed 0.6.1 is working as expected, thanks.

@wxianfeng
Copy link
Author

test passed by 0.6.1, thanks MAN

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants