Skip to content

postgrelize / BelongsToManyOptions

Type Alias: BelongsToManyOptions ​

BelongsToManyOptions = AssociationOptions & Readonly<{ otherKey?: string | ForeignKeyOptions; through: string | ModelStatic<AnyModel> | ThroughOptions; }>

Defined in: src/associations/types.ts:105

Options of belongsToMany.

Extends AssociationOptions; foreignKey is the junction column pointing at the source, otherKey the one pointing at the target.

See ​

Model.belongsToMany

Example ​

ts
const opts: BelongsToManyOptions = { through: 'ProjectTask', foreignKey: 'projectId', otherKey: 'taskId' };
Project.belongsToMany(Task, opts);

Released under the MIT License.