# query.foreignKeys() function · @imqueue/pg-sequelize

Source: https://imqueue.org/api/pg-sequelize/latest/pg-sequelize.query.foreignkeys/
Published: 2026-08-01
Author: @imqueue maintainers (https://github.com/imqueue)
Package: @imqueue/pg-sequelize 4.2.0 — generated reference, not hand-written

Foreign-key column names on a model for the given relations.

**Signature:**

```typescript
export function foreignKeys(model: typeof BaseModel, relations: string[]): string[];
```

## Parameters


| Parameter | Type | Description |
| --- | --- | --- |
| model | typeof [BaseModel](https://imqueue.org/api/pg-sequelize/latest/pg-sequelize.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.

