[PR #5661] fix(cli): use 64 bit ints for numeric IDs for mysql/mssql #14394

Closed
opened 2026-04-13 09:27:14 -05:00 by GiteaMirror · 0 comments
Owner

Original Pull Request: https://github.com/better-auth/better-auth/pull/5661

State: closed
Merged: No


closes https://github.com/better-auth/better-auth/issues/5657

Should generate 64bit for ids with useNumberId. We don't do this for mysql & mssql on kysely, Prisma & Drizzle. This PR resolves such for the CLI generator & handles IDs as BigInt in the adapter factory.


Summary by cubic

Switch numeric IDs to 64-bit (BIGINT) for MySQL and MSSQL when useNumberId is enabled, and handle IDs as BigInt throughout the adapter. This prevents truncation and keeps the CLI generator and runtime consistent.

  • Bug Fixes

    • Generate BIGINT columns for numeric IDs in MySQL/MSSQL migrations.
    • Convert ID values to BigInt in the adapter factory for reads/writes.
    • Allow BigInt and BigInt[] in query Where values.
  • Migration

    • If you previously created INTEGER ID columns on MySQL/MSSQL with useNumberId, alter them to BIGINT.
    • Update application code to use BigInt for IDs (not Number), including query filters and payloads.
**Original Pull Request:** https://github.com/better-auth/better-auth/pull/5661 **State:** closed **Merged:** No --- closes https://github.com/better-auth/better-auth/issues/5657 Should generate 64bit for ids with `useNumberId`. We don't do this for mysql & mssql on kysely, Prisma & Drizzle. This PR resolves such for the CLI generator & handles IDs as `BigInt` in the adapter factory. <!-- This is an auto-generated description by cubic. --> --- ## Summary by cubic Switch numeric IDs to 64-bit (BIGINT) for MySQL and MSSQL when useNumberId is enabled, and handle IDs as BigInt throughout the adapter. This prevents truncation and keeps the CLI generator and runtime consistent. - **Bug Fixes** - Generate BIGINT columns for numeric IDs in MySQL/MSSQL migrations. - Convert ID values to BigInt in the adapter factory for reads/writes. - Allow BigInt and BigInt[] in query Where values. - **Migration** - If you previously created INTEGER ID columns on MySQL/MSSQL with useNumberId, alter them to BIGINT. - Update application code to use BigInt for IDs (not Number), including query filters and payloads. <!-- End of auto-generated description by cubic. -->
GiteaMirror added the pull-request label 2026-04-13 09:27:14 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#14394