drizzle-team / drizzle-team/drizzle-orm-docs
[Docs] Incorrect example output and disambiguating relations snippet in SQLite relations page
- Dominant language
- MDX
- Stars
- 241
- Forks
- 401
- Avg merge
- 5h 44m
- Merged PRs (30d)
- 1
Description
**1. Incorrect example output in `one()` relation section**
At the beginning of the `one()` section, the example output contradicts the relation definition.
The relation is defined as `from: r.posts.ownerId, to: r.users.id`, meaning `ownerId` should match `author.id`. However, the example output shows:
```json
[{
id: 10,
content: "My first post!",
ownerId: 14,
author: {
id: 1,
name: "Alex"
}
}]
```
`ownerId: 14` and `author.id: 1` are inconsistent. One of them should be corrected (e.g., `ownerId` should be `1`).
**2. Incorrect `from` field in `Disambiguating relations` section**
In the `Disambiguating relations` section, the `reviewer` relation incorrectly uses the same foreign key as the `author` relation.
Current code:
```typescript
reviewer: r.one.users({
from: r.posts.authorId, // ❌ Conflict: 'author' already uses this
to: r.users.id,
alias: "reviewer",
}),
```
Since `author` is defined with `from: r.posts.authorId`, the `reviewer` relation must use a different foreign key column (e.g., `from: r.posts.reviewerId`). Currently, this snippet would cause an "not enough information to infer relation" error.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.