We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
20.4.0
I have set up relationships as below
User.ts
@hasMany(() => Task, { foreignKey: 'assignedToId', }) declare assignedTasks: HasMany<typeof Task>
Task.ts
@column({ columnName: 'assigned_to_id' }) declare assignedToId: number @belongsTo(() => User, { foreignKey: 'assignedToId', }) declare assignedTo: BelongsTo<typeof User>
Query
const records = await Task.query() .preload('assignedTo') .orderBy('updated_at', 'desc') .orderBy('created_at', 'desc') .paginate(page, limit) records.forEach((user) => { logger.info('assignedToId=%s preload::assignedTo=%o', user.assignedToId, user.assignedTo) })
Result
DB tables
User
Task
No response
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Package version
20.4.0
Describe the bug
I have set up relationships as below
User.ts
Task.ts
Query
Result
DB tables
User
Task
Reproduction repo
No response
The text was updated successfully, but these errors were encountered: