Change `id` field name?

Hi, I created my database schema before working on adding Better Auth, and I had decided to call the "identifying" id fields of my users uuid, for clarity. Is there a way to tell Better Auth to use uuid as the used field name? I saw that you could change other required field names, but not this one.
7 Replies
Ping
Ping4w ago
Yeah I don't think you can change id. But if you really want it, you'll have to map id to uuid anytime you gather data from DB and send it to the client.
Bell
BellOP4w ago
do I have to change the field name in my db or is there a way to make the translation using hooks / a plugin or something?
Ping
Ping4w ago
No, you can't do anything about this unfortunately. Internally better-auth relies all tables to have at least id.
Bell
BellOP4w ago
would it be possible to modify better auth to let the user configure the name of the id field? (if I wanted to make PR for example)
Ping
Ping4w ago
Yeah you can try. Might be a good idea to ask Bekacru if this would go through first though. cc @bekacru
bekacru
bekacru4w ago
Yeah not a bad idea

Did you find this page helpful?