Skip to content

Add support for ThroughOptions #122

@RobinBuschmann

Description

@RobinBuschmann

See http://docs.sequelizejs.com/manual/tutorial/associations.html#n-m

Post.belongsToMany(Tag, { through: { model: ItemTag, unique: false, scope: { taggable: 'post' } }, foreignKey: 'taggable_id', constraints: false });

and https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/sequelize/index.d.ts#L1374:

interface ThroughOptions { /**  * The model used to join both sides of the N:M association.  */ model: Model<any, any>; /**  * A key/value set that will be used for association create and find defaults on the through model.  * (Remember to add the attributes to the through model)  */ scope?: AssociationScope; /**  * If true a unique key will be generated from the foreign keys used (might want to turn this off and create  * specific unique keys when using scopes)  *  * Defaults to true  */ unique?: boolean; }

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions