How to create join table with foreign keys with sequelize or sequelize-cli
<p>I'm creating models and migrations for two types, Player and Team that have many to many relationship. I'm using sequelize model:create, but don't see how to specify foreign keys or join tables.</p>

<pre><code>sequelize model:create --name Player --attributes "name:string"
sequelize model:create --name Team --attributes "name:string"
</code></pre>

<p>After the model is created, I add associations.
In Player:</p>

<pre><code>Player.belongsToMany(models.Team, { through: 'PlayerTeam', foreignKey: 'playerId', otherKey: 'teamId' });
</code></pre>

<p>In Team:</p>

<pre><code>Team.belongsToMany(models.Player, { through: 'PlayerTeam', foreignKey: 'teamId', otherKey: 'playerId' });
</code></pre>

<p>Then the migrations are run with</p>

<pre><code>sequelize db:migrate
</code></pre>

<p>There are tables for Player and Team but there's no join table (nor foreign keys) in the database. How can the foreign keys and join table be created? Is there a definitive guide on how to do this? </p>