Optional
asThe alias of this model, in singular form. See also the name
option passed to sequelize.define
. If
you create multiple associations between the same tables, you should provide an alias to be able to
distinguish between them. If you provide an alias when creating the association, you should provide the
same alias when eager loading and when getting associated models. Defaults to the singularized name of
target
Optional
foreignThe configuration of the foreign key Attribute. See define or init for more information about the syntax.
Using a string is equivalent to passing a ForeignKeyOptions object with the name option set.
Optional
foreignShould "ON UPDATE", "ON DELETE" and "REFERENCES" constraints be enabled on the foreign key?
This only affects the foreign key that points to the source model. to control the one that points to the target model, set BelongsToManyOptions.inverse.foreignKeyConstraints.
Optional
hooksIf false
the applicable hooks will not be called.
The default value depends on the context.
true
Optional
inverseConfigures this association on the target model.
Optional
as?: string | { Optional
foreignOptional
scope?: AssociationScopeOptional
otherThe name of the foreign key in the join table (representing the target model) or an object representing
the type definition for the other column (see Sequelize.define
for syntax). When using an object, you
can add a name
property to set the name of the colum. Defaults to the name of target + primary key of
target
Optional
scopeA key/value set that will be used for association create and find defaults on the target. (sqlite not supported for N:M)
Optional
sourceThe name of the field to use as the key for the association in the source table. Defaults to the primary key of the source table
Optional
targetThe name of the field to use as the key for the association in the target table. Defaults to the primary key of the target table
The name of the table that is used to join source and target in n:m associations. Can also be a sequelize model if you want to define the junction table yourself and add extra attributes to it.
Generated using TypeDoc
Options provided when associating models with belongsToMany relationship.
Used by belongsToMany.