Skip to content
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

Retrieving additional columns on pivot table (e.g.: updated_at on role_user) #40

Open
stavrogin opened this issue May 5, 2020 · 0 comments

Comments

@stavrogin
Copy link

Hi,

I have to get the last update role assignment of a user, so I have created updated_at timestamp.
When I perform a query such as
let users = (await this.model.query().with('roles').fetch()).toJSON()
when I loop on user.roles, I can see the property "pivot" which contains user_id and role_id.
How can I enrich the "pivot" by adding the updated_at timestamp column that I have added?

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant