Skip to content

Commit

Permalink
docs: added multi-column informations for JoinColumn (#5656)
Browse files Browse the repository at this point in the history
  • Loading branch information
PierreTurnbull committed Mar 11, 2020
1 parent f7052a3 commit 6e598c1
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion docs/relations.md
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,18 @@ category: Category;
```

The relation now refers to `name` of the `Category` entity, instead of `id`.
Column name for that relation will become `categoryName`
Column name for that relation will become `categoryName`.

You can also join multiple columns. Note that they do not reference the primary column of the related entity by default: you must provide the referenced column name.

```typescript
@ManyToOne(type => Category)
@JoinColumn([
{ name: "category_id", referencedColumnName: "id" },
{ name: "locale_id", referencedColumnName: "locale_id" }
])
category: Category;
```

## `@JoinTable` options

Expand Down

0 comments on commit 6e598c1

Please sign in to comment.