title: Adding two of the same foreighn keys to a single model as two different fields in sequelize
body: <p>I am building the database structure for a project using sequelize. I am created the friends table for the project. Is it possible to set a user foreign key to two different fields (friender, friended) in the friend database table using sequelize. I know that I can create a foreign key using <code>Friend.hasOne(User) User.hasMany(Friend)</code> but that just assigns one field as a foreign key. I want to have two foreign keys that are the same model as two different fields. </p>
  
  <p>This is what I have so far for my sequelize database model (Friend):</p>
  
  <pre><code>const seq = require('sequelize');
  const database = require('../index');
  
  const Friend = database.define(
    "friend",
    {
      id:{
        type:seq.INTEGER,
        primaryKey:true,
        autoIncrement:true
      },
      favorite:{
        type:seq.STRING,
        null:true,
        validate:{
          isUrl: true,
        }
      },
    },{
      createdAt: Sequelize.DATE,
      updatedAt: Sequelize.DATE,
    },
    database.sync()
      .then(() =&gt; {
        console.log("Profile table is synced")
      })
      .catch((error) =&gt; {
        console.log("caught error with Profile: " + error)
      })
  );
  
  Friend.hasOne(User)
  User.hasMany(Friends)
  </code></pre>
  
  <p>I want <code>Friend.friender</code> to be a foreign key to <code>User</code> 
  I want <code>Friend.friended</code> to also be a foriegn key to <code>User</code></p>
  
  <p>Not sure how to do this...</p>