[GH-ISSUE #1407] Relating User Data to Another Table #8736

Closed
opened 2026-04-13 03:55:10 -05:00 by GiteaMirror · 2 comments
Owner

Originally created by @thedamod on GitHub (Feb 11, 2025).
Original GitHub issue: https://github.com/better-auth/better-auth/issues/1407

I'm working with Better-Auth and need to associate additional data with my users, stored in a separate table. I'm trying to figure out the best way to create a relationship between the User data managed by Better-Auth and this other table.

Is there currently a supported method, or recommended approach, for achieving this? I'm not sure what the best practice is within the context of Better-Auth.

Any guidance or suggestions you can provide would be greatly appreciated.

Thanks in advance for your time and help.
Aether

Originally created by @thedamod on GitHub (Feb 11, 2025). Original GitHub issue: https://github.com/better-auth/better-auth/issues/1407 I'm working with Better-Auth and need to associate additional data with my users, stored in a separate table. I'm trying to figure out the best way to create a relationship between the User data managed by Better-Auth and this other table. Is there currently a supported method, or recommended approach, for achieving this? I'm not sure what the best practice is within the context of Better-Auth. Any guidance or suggestions you can provide would be greatly appreciated. Thanks in advance for your time and help. Aether
GiteaMirror added the locked label 2026-04-13 03:55:10 -05:00
Author
Owner

@Bekacru commented on GitHub (Feb 11, 2025):

You can add additional field for the referencing field and to return the additional table information on a session you can use custom session

<!-- gh-comment-id:2650721542 --> @Bekacru commented on GitHub (Feb 11, 2025): You can add additional field for the referencing field and to return the additional table information on a session you can use [custom session ](https://www.better-auth.com/docs/concepts/session-management#customizing-session-response)
Author
Owner

@thedamod commented on GitHub (Feb 11, 2025):

Ohh thanks a lot! But I was aiming for a many-to-many relation type thing. Like my user will have multiple courses attached to it and the course will have multiple users attached to it

<!-- gh-comment-id:2651380340 --> @thedamod commented on GitHub (Feb 11, 2025): Ohh thanks a lot! But I was aiming for a many-to-many relation type thing. Like my user will have multiple courses attached to it and the course will have multiple users attached to it
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#8736