title: Sequelize - How to setup foreign key and join on it
body: <p>I have two tables; userPermissions &amp; permissionItems. userPermissions has a permissionItemId as a foreign key, defined as </p>
  
  <pre><code>CONSTRAINT `fk_userPermissions_permissionItemId`
    FOREIGN KEY (`permissionItemId`)
    REFERENCES `mydb`.`permissionItems` (`permissionItemId`)
  </code></pre>
  
  <p>Their Sequelize definitions are</p>
  
  <pre><code>const PermissionItem = db.define('permissionItems', {
    permissionItemId: {
      type: Sequelize.INTEGER,
      autoIncrement: true,
      primaryKey: true
    }
  });
  
  
  const UserPermission = db.define('userPermissions', {
    userPermissionsId: {
      type: Sequelize.INTEGER,
      autoIncrement: true,
      primaryKey: true
    },
    permissionItemId: {
      type: Sequelize.INTEGER,
      references: 'permissionItems',
      referencesKey: 'permissionItemId'
    }
  });
  UserPermission.hasOne(PermissionItem);
  </code></pre>
  
  <p>I am then trying to join those two with the and view the results with</p>
  
  <pre><code>UserPermission.findAll({
    include: [{
      model: PermissionItem
    }]
  }).then(userPermission =&gt; {
    console.log('userPermission', userPermission);
  });
  </code></pre>
  
  <p>My expectation here is to get a list of all UserPermissions and outer left join PermissionItem on permissionItemId. Instead, I receive the below error</p>
  
  <blockquote>
    <p>Unhandled rejection SequelizeDatabaseError: Unknown column
    'permissionItem.userPermissionUserPermissionsId' in 'field list'</p>
  </blockquote>
  
  <p>Have I constructed the query incorrectly? Or the Sequelize definitions?</p>
  
  <p>I have tried flipping these around and including the reverse, and applying the keys backward, in every combination I could think of, all to no avail</p>