sdepold/sequelize — pull request #190 by janmeier (2012-06-13 19:31:18+00:00)
Title: Self-association with hasMany does not require a junction table.

This change was mandated by the following schema:

Comment {
Content: DataTypes.STRING,
ParentId: DataTypes.INTEGER
}

A comment can have one parent, and can have multiple children. Calling Comment.hasMany(Comment) would create a junction table to link two comments, but this is not needed, since a comment simply specifies it's parent.

To achieve this, isManyMany: false can be passed in the options hash when calling Comment.hasMany()

Comment.hasMany(Comment, {as: 'Children', foreignKey: "ParentId", isManyMany: false})

Two test have been added to has-many.spec, and all tests pass