[GH-ISSUE #227] Support int autoincrement IDs #8178

Closed
opened 2026-04-13 03:16:44 -05:00 by GiteaMirror · 6 comments
Owner

Originally created by @ck-euan on GitHub (Oct 18, 2024).
Original GitHub issue: https://github.com/better-auth/better-auth/issues/227

Is your feature request related to a problem? Please describe.
I want to implement better-auth in an existing app and the users table uses an autoincrement int for the primary key and I can't change this.

Describe the solution you'd like
It would be great if better auth could handle both string and int IDs

Describe alternatives you've considered
N/A

Additional context
N/A

Originally created by @ck-euan on GitHub (Oct 18, 2024). Original GitHub issue: https://github.com/better-auth/better-auth/issues/227 **Is your feature request related to a problem? Please describe.** I want to implement better-auth in an existing app and the users table uses an autoincrement int for the primary key and I can't change this. **Describe the solution you'd like** It would be great if better auth could handle both string and int IDs **Describe alternatives you've considered** N/A **Additional context** N/A
GiteaMirror added the locked label 2026-04-13 03:16:44 -05:00
Author
Owner

@Bekacru commented on GitHub (Nov 28, 2024):

This should work from v1 (v1.0.6) onward. Make sure to turn off auto-generate IDs in advanced.generateId. Feel free to open a new issue if you're facing problems.

<!-- gh-comment-id:2505320217 --> @Bekacru commented on GitHub (Nov 28, 2024): This should work from v1 (v1.0.6) onward. Make sure to turn off auto-generate IDs in `advanced.generateId`. Feel free to open a new issue if you're facing problems.
Author
Owner

@ck-euan commented on GitHub (Dec 10, 2024):

@Bekacru Is there a recommended way to override the types for the user ID? Everywhere I get the session it is typed as string

<!-- gh-comment-id:2531645799 --> @ck-euan commented on GitHub (Dec 10, 2024): @Bekacru Is there a recommended way to override the types for the user ID? Everywhere I get the session it is typed as string
Author
Owner

@marcusleonas commented on GitHub (Dec 22, 2024):

@Bekacru Is there a recommended way to override the types for the user ID? Everywhere I get the session it is typed as string

Is there any update on this? The docs don't explain how to do this other than adding custom fields.

<!-- gh-comment-id:2558543435 --> @marcusleonas commented on GitHub (Dec 22, 2024): > @Bekacru Is there a recommended way to override the types for the user ID? Everywhere I get the session it is typed as string Is there any update on this? The docs don't explain how to do this other than adding custom fields.
Author
Owner

@Bekacru commented on GitHub (Dec 23, 2024):

Is there any update on this? The docs don't explain how to do this other than adding custom fields.

disable auto generated IDs by setting advanced.generteId to false and it should work

<!-- gh-comment-id:2558946964 --> @Bekacru commented on GitHub (Dec 23, 2024): > Is there any update on this? The docs don't explain how to do this other than adding custom fields. disable auto generated IDs by setting `advanced.generteId` to false and it should work
Author
Owner

@platform-kit commented on GitHub (Dec 30, 2024):

@Bekacru do you mean this would enable a different field type (i.e. INT or UUID in place of string , for user id)? Would this custom field extend to plugins etc too?

<!-- gh-comment-id:2565969465 --> @platform-kit commented on GitHub (Dec 30, 2024): @Bekacru do you mean this would enable a different field type (i.e. INT or UUID in place of string , for user id)? Would this custom field extend to plugins etc too?
Author
Owner

@marcusleonas commented on GitHub (Jan 2, 2025):

Is there any update on this? The docs don't explain how to do this other than adding custom fields.

disable auto generated IDs by setting advanced.generteId to false and it should work

This works, but the types aren't number, they are string.

<!-- gh-comment-id:2567698105 --> @marcusleonas commented on GitHub (Jan 2, 2025): > > Is there any update on this? The docs don't explain how to do this other than adding custom fields. > > disable auto generated IDs by setting `advanced.generteId` to false and it should work This works, but the types aren't number, they are string.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#8178