title: Sequelize JS - Which do I use? Model.key.references or 'Associations'?
body: <p>I'm new to Sequelize. Current working on a small schema, needed to add a foreign key to a table, and found the following:</p>
  
  <pre><code>sequelize.define(
      "my_model", {
          "id": {
              type: Sequelize.UUID,
              primaryKey: true,
              defaultValue: Sequelize.UUIDV4
          },
  
          ...
  
          "linked_model": {
              type: Sequelize.UUID,
  
              // Should I be using this form to create foreign keys?
              references: {
                  model: MyOtherModel,
                  key: id
              }
          }
      }
  )
  </code></pre>
  
  <p>A little later, I found out about the associations API - <a href="http://docs.sequelizejs.com/manual/tutorial/associations.html" rel="nofollow noreferrer">http://docs.sequelizejs.com/manual/tutorial/associations.html</a> - Which can also be used to create foreign keys on related tables:</p>
  
  <pre><code>const Player = this.sequelize.define('player', {/* attributes */});
  const Team  = this.sequelize.define('team', {/* attributes */});
  
  Player.belongsTo(Team); // Will add a teamId attribute to Player to hold the primary key value for Team
  </code></pre>
  
  <p>The same question also appears here - <a href="https://stackoverflow.com/questions/46305459/sequelize-model-references-vs-associations">Sequelize model references vs associations</a></p>
  
  <p>Which of the two is considered best practice?</p>