Skip to content

Commit f3be966

Browse files
authored
docs: fix bidirectional association examples in v7 upgrade guide (#565)
1 parent ba68eca commit f3be966

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

docs/other-topics/upgrade.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -397,14 +397,14 @@ This lead to subtle bugs, so starting with v7, associations options must perfect
397397
For instance, the following declaration is no longer valid:
398398

399399
```typescript
400-
User.belongsToMany(Countries, { foreignKey: 'user_id' });
401-
Countries.belongsToMany(User);
400+
User.belongsToMany(Country, { foreignKey: 'user_id' });
401+
Country.belongsToMany(User);
402402
```
403403

404404
But this is:
405405

406406
```typescript
407-
User.belongsToMany(User, { foreignKey: 'user_id' });
407+
User.belongsToMany(Country, { foreignKey: 'user_id' });
408408
Country.belongsToMany(User, { otherKey: 'user_id' });
409409
```
410410

@@ -417,15 +417,15 @@ Instead of writing this:
417417

418418
```typescript
419419
User.belongsToMany(Country, { as: 'countries' });
420-
User.belongsToMany(User, { as: 'citizen' });
420+
Country.belongsToMany(User, { as: 'citizens' });
421421
```
422422

423423
You can now write this:
424424

425425
```typescript
426426
User.belongsToMany(Country, {
427427
as: 'countries',
428-
inverse: { as: 'citizen' },
428+
inverse: { as: 'citizens' },
429429
});
430430
```
431431

0 commit comments

Comments
 (0)