geddy / model

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

Migrations with autoIncrementId = true failing in Mysql #237

Closed der-On closed 9 years ago

der-On commented 9 years ago

This is due to the SQL generator beeing optimized for Postgres and not for mysql: https://github.com/geddy/model/blob/master/lib/generators/sql.js#L88

Changing "BIGSERAIAL" in that line to "BIGINT(20) auto_increment" fixes the problem, but would propably introduce a problem in postgres. I'm not sure how to distinguish between mysql/postgres here.

mde commented 9 years ago

SWEET!

gabriel-alecu commented 8 years ago

The latest version on NPM is still 6.0.1, which has the broken mysql autoincrement, and propagates the issue to geddy...