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
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.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?
No, you can't do anything about this unfortunately.
Internally better-auth relies all tables to have at least
id
.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)
Yeah you can try. Might be a good idea to ask Bekacru if this would go through first though.
cc @bekacru
Yeah not a bad idea
To add on, a potential idea:
https://discord.com/channels/1288403910284935179/1351947775910088756/1351947775910088756