不要怂,就是干,撸起袖子干!

Commit 91416e3b by Wojtek Committed by GitHub

docs(assocs): fix typos in assocs manual (#11888)

1 parent baf7fab3
Showing with 3 additions and 4 deletions
...@@ -73,7 +73,7 @@ In principle, both options are a valid way to establish a One-To-One relationshi ...@@ -73,7 +73,7 @@ In principle, both options are a valid way to establish a One-To-One relationshi
### Goal ### Goal
For the rest of this example, let's assume that we have two models, `Foo` and `Bar`. We want to setup a One-To-One relationship between them such that `Foo` gets a `barId` column. For the rest of this example, let's assume that we have two models, `Foo` and `Bar`. We want to setup a One-To-One relationship between them such that `Bar` gets a `fooId` column.
### Implementation ### Implementation
...@@ -84,7 +84,7 @@ Foo.hasOne(Bar); ...@@ -84,7 +84,7 @@ Foo.hasOne(Bar);
Bar.belongsTo(Foo); Bar.belongsTo(Foo);
``` ```
Since no option was passed, Sequelize will infer what to do from the names of the models. In this case, Sequelize knows that a `barId` column must be added to `Foo`. Since no option was passed, Sequelize will infer what to do from the names of the models. In this case, Sequelize knows that a `fooId` column must be added to `Bar`.
This way, calling `Bar.sync()` after the above will yield the following SQL (on PostgreSQL, for example): This way, calling `Bar.sync()` after the above will yield the following SQL (on PostgreSQL, for example):
...@@ -775,4 +775,4 @@ The trick to deciding between `sourceKey` and `targetKey` is just to remember wh ...@@ -775,4 +775,4 @@ The trick to deciding between `sourceKey` and `targetKey` is just to remember wh
* `A.hasOne(B)` and `A.hasMany(B)` keep the foreign key in the target model (`B`), therefore the referenced key is in the source model, hence the usage of `sourceKey`. * `A.hasOne(B)` and `A.hasMany(B)` keep the foreign key in the target model (`B`), therefore the referenced key is in the source model, hence the usage of `sourceKey`.
* `A.belongsToMany(B)` involves an extra table (the junction table), therefore both `sourceKey` and `targetKey` are usable, with `sourceKey` corresponding to some field in `A` (the source) and `targetKey` corresponding to some field in `B` (the target). * `A.belongsToMany(B)` involves an extra table (the junction table), therefore both `sourceKey` and `targetKey` are usable, with `sourceKey` corresponding to some field in `A` (the source) and `targetKey` corresponding to some field in `B` (the target).
\ No newline at end of file
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!