title: Sequelize cyclic dependency
body: <p>This is my User model</p>
  
  <pre><code>'use strict';
  var bcrypt = require('bcrypt');
  
  module.exports = function(sequelize, DataTypes) {
    var User = sequelize.define('User', {
      email: {
        type: DataTypes.STRING,
        validate: {
          isEmail: true,
          notEmpty: true,
          notNull: false
        },
        unique: true
      },
  
      password: DataTypes.STRING,
      name: DataTypes.STRING,
  
      username: {
        type: DataTypes.STRING,
        unique: true
      },
  
      admin: DataTypes.BOOLEAN,
  
      googleId: DataTypes.BOOLEAN
  
    }, {
      classMethods: {
        associate: function(models) {
          User.hasMany(models.Award);
          User.hasMany(models.Media);
          User.hasMany(models.Comment);
          User.hasMany(models.Like);
          User.hasMany(models.CheckIn);
        }
      }
    });
  
  
    return User;
  };
  </code></pre>
  
  <p>and this is my Media model:</p>
  
  <pre><code>'use strict';
  
  module.exports = function(sequelize, DataTypes) {
    var Media = sequelize.define('Media', {
  
      type: DataTypes.ENUM('photo', 'video'),
      description: DataTypes.STRING,
  
      url: DataTypes.STRING,
  
      gps: DataTypes.GEOMETRY('POINT')
  
    }, {
      classMethods: {
        associate: function(models) {
          //Media.belongsTo(models.Event);
          //Media.belongsTo(models.User);
          Media.hasMany(models.Comment);
          Media.hasMany(models.Like);
        }
      }
    });
  
  
    return Media;
  };
  </code></pre>
  
  <p>And I'm getting this error:</p>
  
  <pre><code>Unhandled rejection Error: Cyclic dependency found. Users is dependent of itself.
  Dependency chain: Awards -&gt; Users -&gt; Media =&gt; Users
  </code></pre>
  
  <p>Previously I had a cyclic dependency and it's now removed but sequelize still throws this error. Why is this happening?</p>
  
  <p>If I remove the User.hasMany(models.Media) association the error will disappear. But why is it still happening when the Media model has no reference to the User model?</p>