geddy / model

Datastore-agnostic ORM in JavaScript
265 stars 55 forks source link

Sequential IDs Not MySQL Compatible? #241

Closed danfinlay closed 9 years ago

danfinlay commented 9 years ago

I tried hooking up my app (which uses Sequential IDs) to a MySQL database where I'd used Postgres before, and during db:init it threw an error:

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 'BIGSERIAL PRIMARY KEY, `created_at` TIMESTAMP NULL, `updated_at` TIMESTAMP NULL,' at line 1
    at Query.Sequence._packetToError (/my_project/node_modules/mysql/lib/protocol/sequences/Sequence.js:48:14)
    at Query.ErrorPacket (/my_project/node_modules/mysql/lib/protocol/sequences/Query.js:82:18)
    at Protocol._parsePacket (/my_project/node_modules/mysql/lib/protocol/Protocol.js:271:23)
    at Parser.write (/my_project/node_modules/mysql/lib/protocol/Parser.js:77:12)
    at Protocol.write (/my_project/node_modules/mysql/lib/protocol/Protocol.js:39:16)
    at Socket.<anonymous> (/my_project/node_modules/mysql/lib/Connection.js:82:28)
    at Socket.emit (events.js:95:17)
    at Socket.<anonymous> (_stream_readable.js:764:14)
    at Socket.emit (events.js:92:17)
    at emitReadable_ (_stream_readable.js:426:10)

I suspect this has to do with a data type that isn't MySQL supported, but I'm not sure yet.

mde commented 9 years ago

Right now autoincrement is only supported and tested in Postgres:

https://github.com/geddy/model/blob/master/test/integration/adapters/sql/postgres_auto_increment_id.js

I'd love a PR that implements it for MySQL. :D

der-On commented 9 years ago

Strongly related to #237

gabriel-alecu commented 8 years ago

A heads up that 6.0.2, which fixes this problem, is not yet available on npm, which leads to geddy still having the broken version.