[PR #5809] feat: add support for uuids #14487

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

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

State: closed
Merged: Yes


Summary by cubic

Add first-class UUID support for IDs and standardize ID generation via advanced.database.generateId. Deprecates useNumberId and updates migrations/adapter logic to handle "uuid" and "serial" across Postgres, MySQL, and MSSQL.

  • New Features

    • generateId now accepts "uuid" and "serial".
    • Migrations create UUID columns and defaults:
      • Postgres: uuid type with default gen_random_uuid().
      • MySQL/MSSQL: uuid type with default uuid().
    • Validation updated: requesting numeric IDs ("serial"/useNumberId) throws if the adapter doesn’t support them.
    • Deprecation warning added for useNumberId; prefer generateId: "serial".
  • Migration

    • Replace useNumberId with generateId: "serial".
    • To enable UUIDs, set generateId: "uuid".
    • Postgres requires the pgcrypto extension for gen_random_uuid().

Written for commit cc50d5f28f. Summary will update automatically on new commits.

**Original Pull Request:** https://github.com/better-auth/better-auth/pull/5809 **State:** closed **Merged:** Yes --- <!-- This is an auto-generated description by cubic. --> ## Summary by cubic Add first-class UUID support for IDs and standardize ID generation via advanced.database.generateId. Deprecates useNumberId and updates migrations/adapter logic to handle "uuid" and "serial" across Postgres, MySQL, and MSSQL. - **New Features** - generateId now accepts "uuid" and "serial". - Migrations create UUID columns and defaults: - Postgres: uuid type with default gen_random_uuid(). - MySQL/MSSQL: uuid type with default uuid(). - Validation updated: requesting numeric IDs ("serial"/useNumberId) throws if the adapter doesn’t support them. - Deprecation warning added for useNumberId; prefer generateId: "serial". - **Migration** - Replace useNumberId with generateId: "serial". - To enable UUIDs, set generateId: "uuid". - Postgres requires the pgcrypto extension for gen_random_uuid(). <sup>Written for commit cc50d5f28f7c85d63ea28f8b167bfcf3429bc178. Summary will update automatically on new commits.</sup> <!-- End of auto-generated description by cubic. -->
GiteaMirror added the pull-request label 2026-04-13 09:29:59 -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#14487