Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: fix bidirectional association examples in v7 upgrade guide #565

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions docs/other-topics/upgrade.md
Original file line number Diff line number Diff line change
Expand Up @@ -397,14 +397,14 @@ This lead to subtle bugs, so starting with v7, associations options must perfect
For instance, the following declaration is no longer valid:

```typescript
User.belongsToMany(Countries, { foreignKey: 'user_id' });
Countries.belongsToMany(User);
User.belongsToMany(Country, { foreignKey: 'user_id' });
Country.belongsToMany(User);
```

But this is:

```typescript
User.belongsToMany(User, { foreignKey: 'user_id' });
User.belongsToMany(Country, { foreignKey: 'user_id' });
Country.belongsToMany(User, { otherKey: 'user_id' });
```

Expand All @@ -417,15 +417,15 @@ Instead of writing this:

```typescript
User.belongsToMany(Country, { as: 'countries' });
User.belongsToMany(User, { as: 'citizen' });
Country.belongsToMany(User, { as: 'citizens' });
```

You can now write this:

```typescript
User.belongsToMany(Country, {
as: 'countries',
inverse: { as: 'citizen' },
inverse: { as: 'citizens' },
});
```

Expand Down