Inferring additional fields on hooks
The additional field role is not found inside the databasehooks.
I ran
better-auth/cli generate
and prisma migrate
as you can see the screenshot from the prisma studio , the user table have that column.
I also tried restarting the TS server on vscode which did not solve the issue

Solution:Jump to solution
Hey guys ( @aswnss, @Rufis ), this is a known limitation of Better-auth.
However I do have a PR which fixes this. Once merged your issue will be resolved.
You can track the PR here:
https://github.com/better-auth/better-auth/pull/2158...
GitHub
refactor:
betterAuth
fn now infers models by ping-maxwell · Pull...We now infer models based on the options:
Previously:
How?
The betterAuth function now has generics for plugins, as well as any model data that could be modified by options, such as User additio...
6 Replies
It is not being passed as well, getting undefined when console logged
It is inferred outside the auth

I am having the same issue, I was thinking it was just me who had this
Solution
Hey guys ( @aswnss, @Rufis ), this is a known limitation of Better-auth.
However I do have a PR which fixes this. Once merged your issue will be resolved.
You can track the PR here:
https://github.com/better-auth/better-auth/pull/2158
GitHub
refactor:
betterAuth
fn now infers models by ping-maxwell · Pull...We now infer models based on the options:
Previously:
How?
The betterAuth function now has generics for plugins, as well as any model data that could be modified by options, such as User additio...
Thanks for everything, honestly making auth so easy to use :pepe_love:
That is great . For my issue though I wanted to create a new entry to the db and then link that to the user entry before or after the user was created . Something like "Initialise the other things that user is connected to".
What i did was I extended the user table with an empty field
linkedId
and then will later initialize the other stuff later by an api call and link it after wards.
Could have done this with database hook though , when your pr is merged @Ping