-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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(repository): add hasOne relation docs #2161
Conversation
Builds failing because of #2159 (comment). |
docs/site/hasOne-relation.md
Outdated
|
||
1. Make `supplierId` property or column a foreign key which references the `id` | ||
from Supplier model's `id` property: | ||
- `alter table <databaseName>.Account add foreign key (supplierId) REFERENCES <databaseName>.Supplier(id);` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please create a fenced block using triple back-ticks instead of using inline code.
Also I believe the usual convention is to use all-upper-case letters for SQL commands, e.g. ALTER TABLE
.
@bajtos LGTY now? @raymondfeng @strongloop/loopback-maintainers PTAL. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
docs/site/hasOne-relation.md
Outdated
key on the source model and a unique constraint on the same column/key to ensure | ||
one-to-one mapping. This relation indicates that each instance of the declaring | ||
or source model has exactly one instance of the target model. Let's take an | ||
example where an application has models supplier and account and a supplier can |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nitpick: shall we wrap the model name with backticks? Or start with upper case, like Supplier
Account
.
docs/site/hasOne-relation.md
Outdated
- Declare a property with the factory function type | ||
`HasOneRepositoryFactory<targetModel, typeof sourceModel.prototype.id>` on the | ||
source repository class. | ||
- call the `createHasOneRepositoryFactoryFor` function in the constructor of the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nitpick: Call
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
createHasOneRepositoryFactoryFor does not exist. For some reason _createHasOneRepositoryFactoryFor does. Is this correct?
e703494
to
9e81c3c
Compare
9e81c3c
to
e07ccaf
Compare
1. Make `supplierId` property or column a foreign key which references the `id` | ||
from Supplier model's `id` property: | ||
|
||
```sql |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will put the code block outside of the list. To keep it inside the current list item, you need to indent it by 4 spaces. Same comment applies to the next two lines and also the other SQL block below (lines 148-150).
Add docs for
hasOne
relation. Related to #1422.Checklist
npm test
passes on your machinepackages/cli
were updatedexamples/*
were updated