1602 / jugglingdb

Multi-database ORM for nodejs: redis, mongodb, mysql, sqlite3, postgresql, arango, in-memory...
http://1602.github.io/jugglingdb/
2.05k stars 241 forks source link

Table without `id` column error #389

Closed Keloo closed 10 years ago

Keloo commented 10 years ago

If I have a table without column id, when trying to create a new row it gives error: { [Error: ER_BAD_FIELD_ERROR: Unknown column 'id' in 'field list'] code: 'ER_BAD_FIELD_ERROR', errno: 1054, sqlState: '42S22', index: 0 }

In the logs of mysql database I see an INSERT with ",id = NULL" added at the end.

After debugging I realize that this is added in /lib/schema.js on line 260

properties.id = properties.id || { type: schema.settings.slave ? String : Number };

Is it correctly or I misunderstood something? How can I use jugglingdb on tables without "id" column?