You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Model creates two primary keys with same column using Model.sync() function #484
I'm trying to generate my MySQL database tables from my node-orm models. Here's what I got:
var db = require('orm').db;
var User = db.define('user', {
name: String,
email: String,
token: String
});
db.drop(function(){
User.sync(function(){
});
});
I let the User.sync() generates the User table in my database, I had successfully done this before but now my tables have two primary keys with the same column as you can see on the image:
I've been getting "ER_OPERAND_COLUMNS: Operand should contain 1 column(s)" error everytime I want to add and instance of User to another model instance.
Activity
figalex commentedon Apr 2, 2014
Also, tables that should have a foreign key doesn't have that foreign key, it is not being created.
Fix duplicate key indices - #484
dxg commentedon Apr 8, 2014
It doesn't have two primary keys, it has two indexes for the one primary key which is wrong.. I just fixed it and released orm 2.1.5.
As for foreign keys, ORM does not manage them at all.
The migrations plugin can create foreign key constraints.