How do I get sequelize to create id for join table?
<p>See these models and relationships:</p>

<pre><code>var User = sequelize.define('user', {
  name: {type: Sequelize.STRING, unique: true},
  password: Sequelize.STRING,
  email: Sequelize.STRING
});

var Group = sequelize.define('group', {
  name: Sequelize.STRING,
});

var Membership = sequelize.define('membership', {
  foo: Sequelize.STRING
});

var Query = sequelize.define('query', {
  text: Sequelize.STRING,
});

User.belongsToMany(Group, {through: Membership});
Group.belongsToMany(User, {through: Membership});

Query.belongsTo(Membership);
Membership.hasMany(Query);
</code></pre>

<p>Why doesn't sequelize create an id column for Membership? How can i make it create it? Why does it create a column called <code>membershipGroupId</code>?</p>

<p>To answer @denisazevedo, i am using <code>sync</code> with <code>force</code>. Below is the output from the sync</p>

<pre><code>Executing (default): DROP TABLE IF EXISTS `memberships`;
Executing (default): DROP TABLE IF EXISTS `groups`;
Executing (default): DROP TABLE IF EXISTS `cookies`;
Executing (default): DROP TABLE IF EXISTS `events`;
Executing (default): DROP TABLE IF EXISTS `clients`;
Executing (default): DROP TABLE IF EXISTS `users`;
Executing (default): DROP TABLE IF EXISTS `results`;
Executing (default): DROP TABLE IF EXISTS `queries`;
Executing (default): DROP TABLE IF EXISTS `queries`;
Executing (default): CREATE TABLE IF NOT EXISTS `queries` (`id` INTEGER NOT NULL auto_increment , `text` VARCHAR(255), `createdAt` DATETIME NOT NULL, `updatedAt` DATETIME NOT NULL, `membershipGroupId` INTEGER, PRIMARY KEY (`id`)) ENGINE=InnoDB;
Executing (default): SHOW INDEX FROM `queries`
Executing (default): DROP TABLE IF EXISTS `results`;
Executing (default): CREATE TABLE IF NOT EXISTS `results` (`id` INTEGER NOT NULL auto_increment , `link` VARCHAR(2048), `description` TEXT, `result_order` FLOAT(5,2), `title` VARCHAR(255), `result_relevance` ENUM('up', 'down', 'none'), `createdAt` DATETIME NOT NULL, `updatedAt` DATETIME NOT NULL, `queryId` INTEGER, PRIMARY KEY (`id`), FOREIGN KEY (`queryId`) REFERENCES `queries` (`id`) ON DELETE SET NULL ON UPDATE CASCADE) ENGINE=InnoDB;
Executing (default): SHOW INDEX FROM `results`
Executing (default): DROP TABLE IF EXISTS `users`;
Executing (default): CREATE TABLE IF NOT EXISTS `users` (`id` INTEGER NOT NULL auto_increment , `name` VARCHAR(255) UNIQUE, `password` VARCHAR(255), `email` VARCHAR(255), `role` ENUM('facilitator', 'participant'), `createdAt` DATETIME NOT NULL, `updatedAt` DATETIME NOT NULL, PRIMARY KEY (`id`)) ENGINE=InnoDB;
Executing (default): SHOW INDEX FROM `users`
Executing (default): DROP TABLE IF EXISTS `clients`;
Executing (default): CREATE TABLE IF NOT EXISTS `clients` (`id` INTEGER NOT NULL auto_increment , `socketid` VARCHAR(255), `connected` DATETIME, `disconnected` DATETIME, `createdAt` DATETIME NOT NULL, `updatedAt` DATETIME NOT NULL, `userId` INTEGER, PRIMARY KEY (`id`), FOREIGN KEY (`userId`) REFERENCES `users` (`id`) ON DELETE SET NULL ON UPDATE CASCADE) ENGINE=InnoDB;
Executing (default): SHOW INDEX FROM `clients`
Executing (default): DROP TABLE IF EXISTS `events`;
Executing (default): CREATE TABLE IF NOT EXISTS `events` (`id` INTEGER NOT NULL auto_increment , `description` TEXT, `type` ENUM('vote_up', 'vote_down', 'critisort', 'originalsort', 'logout', 'login', 'follow', 'search'), `createdAt` DATETIME NOT NULL, `updatedAt` DATETIME NOT NULL, `clientId` INTEGER, `resultId` INTEGER, `queryId` INTEGER, PRIMARY KEY (`id`), FOREIGN KEY (`clientId`) REFERENCES `clients` (`id`) ON DELETE SET NULL ON UPDATE CASCADE, FOREIGN KEY (`resultId`) REFERENCES `results` (`id`) ON DELETE SET NULL ON UPDATE CASCADE, FOREIGN KEY (`queryId`) REFERENCES `queries` (`id`) ON DELETE SET NULL ON UPDATE CASCADE) ENGINE=InnoDB;
Executing (default): SHOW INDEX FROM `events`
Executing (default): DROP TABLE IF EXISTS `cookies`;
Executing (default): CREATE TABLE IF NOT EXISTS `cookies` (`id` INTEGER NOT NULL auto_increment , `key` VARCHAR(255), `uid` VARCHAR(255) UNIQUE, `createdAt` DATETIME NOT NULL, `updatedAt` DATETIME NOT NULL, PRIMARY KEY (`id`)) ENGINE=InnoDB;
Executing (default): SHOW INDEX FROM `cookies`
Executing (default): DROP TABLE IF EXISTS `groups`;
Executing (default): CREATE TABLE IF NOT EXISTS `groups` (`id` INTEGER NOT NULL auto_increment , `name` VARCHAR(255), `createdAt` DATETIME NOT NULL, `updatedAt` DATETIME NOT NULL, `ownerId` INTEGER, PRIMARY KEY (`id`), FOREIGN KEY (`ownerId`) REFERENCES `users` (`id`) ON DELETE SET NULL ON UPDATE CASCADE) ENGINE=InnoDB;
Executing (default): SHOW INDEX FROM `groups`
Executing (default): DROP TABLE IF EXISTS `memberships`;
Executing (default): CREATE TABLE IF NOT EXISTS `memberships` (`foo` VARCHAR(255), `createdAt` DATETIME NOT NULL, `updatedAt` DATETIME NOT NULL, `groupId` INTEGER , `userId` INTEGER , PRIMARY KEY (`groupId`, `userId`), FOREIGN KEY (`groupId`) REFERENCES `groups` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, FOREIGN KEY (`userId`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE) ENGINE=InnoDB;
Executing (default): SHOW INDEX FROM `memberships`
</code></pre>