$ open source · GPL-3.0 — need a commercial license? imqueue.com →

query.foreignKeys() function

Foreign-key column names on a model for the given relations.

Signature:

export function foreignKeys(model: typeof BaseModel, relations: string[]): string[];

Parameters

Parameter

Type

Description

model

typeof BaseModel

Model holding the foreign keys.

relations

string[]

Association names to collect keys for.

Returns:

string[]

The foreign-key column names.

Remarks

These have to be selected even when the caller did not ask for them, or Sequelize cannot attach the joined rows — which is why autoQuery merges them into the attribute list.