Interface ThroughOptions<ThroughModel>

Used for the through table in n:m associations.

Used in BelongsToManyOptions.through

interface ThroughOptions<ThroughModel> {
    model: string | MaybeForwardedModelStatic<ThroughModel>;
    paranoid?: boolean;
    scope?: AssociationScope;
    timestamps?: boolean;
    unique?: string | boolean;
}

Type Parameters

  • ThroughModel extends Model

Properties

The model used to join both sides of the N:M association. Can be a string if you want the model to be generated by sequelize.

paranoid?: boolean

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)

timestamps?: boolean
unique?: string | boolean

If true a unique constraint will be added on the foreign key pair. If set to a string, the generated unique key will use the string as its name. If set to false, no unique constraint will be added. Useful if you want to turn this off and create your own unique constraint when using scopes.

This option only works if the model already has a Primary Key, as the unique constraint will not be added if the foreign keys are already part of the composite primary key.

Default

true