From f30c78f2f085f60c09cca048b24b6ae717955a24 Mon Sep 17 00:00:00 2001 From: medgardo Date: Fri, 25 Aug 2023 00:59:04 -0400 Subject: [PATCH] docs: fix bidirectional association examples in v7 upgrade guide --- docs/other-topics/upgrade.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/docs/other-topics/upgrade.md b/docs/other-topics/upgrade.md index 2fe34db63..b43b93e9c 100644 --- a/docs/other-topics/upgrade.md +++ b/docs/other-topics/upgrade.md @@ -295,14 +295,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' }); ``` @@ -315,7 +315,7 @@ 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: @@ -323,7 +323,7 @@ You can now write this: ```typescript User.belongsToMany(Country, { as: 'countries', - inverse: { as: 'citizen' }, + inverse: { as: 'citizens' }, }); ```