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 Sequelize#define or Model.init for more information about the syntax.
Using a string is equivalent to passing a ForeignKeyOptions object with the ForeignKeyOptions.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 the "foreignKeyConstraints" option in BelongsToManyOptions.inverse.
Optional
hooksIf false
the applicable hooks will not be called.
The default value depends on the context.
true
Optional
inverseThe name of the inverse association, or an object for further association setup.
Optional
as?: string | { Optional
foreignOptional
scope?: AssociationScopeOptional
otherThe name of the foreign key attribute in the through model (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 attribute to use as the key for the association in the source table. Defaults to the primary key attribute of the source model
Optional
targetThe name of the attribute to use as the key for the association in the target table. Defaults to the primary key attribute of the target model
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.
Optional
throughConfigures the name of the associations that will be defined between the source model and the through model, as well as between the target model and the through model.
Optional
fromThe name of the HasMany association going from the Source model to the Through model.
By default, the association will be the name of the BelongsToMany association
Optional
fromThe name of the HasMany association going from the Target model to the Through model.
By default, the association will be the name of the Inverse BelongsToMany association
Optional
toThe name of the BelongsTo association going from the Through model to the Source model.
By default, the association name will be the name of the inverse BelongsToMany association, singularized.
Optional
toThe name of the BelongsTo association going from the Through model to the Target model.
By default, the association name will be the name of the parent BelongsToMany association, singularized.
Options provided when associating models with belongsToMany relationship.
Used by Model.belongsToMany.