How to generate real/decimal in the schema from a plugin? "number" currently gives integer #541

Open
opened 2026-03-13 07:52:00 -05:00 by GiteaMirror · 8 comments
Owner

Originally created by @colmanhumphrey on GitHub (Jan 9, 2025).

Is this suited for github?

  • Yes, this is suited for github

Currently if I'm making an extension, my type options (from "Fields" in https://www.better-auth.com/docs/concepts/plugins) are string, number, boolean, or date.

If I choose number, like so:

export const somePlugin = () => {
  return {
    id: "some-plugin",
    schema: {
      user: {
        fields: {
          someFloatField: {
            type: "number",
            required: false,
          },...

The generated schema (at least with drizzle) from @better-auth/cli will use integer from "drizzle-orm/pg-core" (and never real or decimal.

Describe the solution you'd like

Maybe either a more specific type field, or some other easy way to specify that I want a float.

In any case, I'd like a way to have real (or decimal) be imported from "drizzle-orm/pg-core".

Describe alternatives you've considered

Manually editing the generated schema

Additional context

Thanks for the project!

Originally created by @colmanhumphrey on GitHub (Jan 9, 2025). ### Is this suited for github? - [X] Yes, this is suited for github ### Is your feature request related to a problem? Please describe. Currently if I'm making an extension, my type options (from "Fields" in https://www.better-auth.com/docs/concepts/plugins) are string, number, boolean, or date. If I choose number, like so: ``` export const somePlugin = () => { return { id: "some-plugin", schema: { user: { fields: { someFloatField: { type: "number", required: false, },... ``` The generated schema (at least with drizzle) from `@better-auth/cli` will use `integer` from `"drizzle-orm/pg-core"` (and never `real` or `decimal`. ### Describe the solution you'd like Maybe either a more specific `type` field, or some other easy way to specify that I want a float. In any case, I'd like a way to have `real` (or `decimal`) be imported from `"drizzle-orm/pg-core"`. ### Describe alternatives you've considered Manually editing the generated schema ### Additional context Thanks for the project!
Author
Owner

@dosubot[bot] commented on GitHub (Jun 12, 2025):

Hi, @colmanhumphrey. I'm Dosu, and I'm helping the better-auth team manage their backlog. I'm marking this issue as stale.

Issue Summary:

  • You reported an issue with the Better Auth framework plugin.
  • Specifying a field type as "number" results in an integer type being generated.
  • You requested a solution to specify float types directly to avoid manual schema edits.
  • There have been no comments or activity on this issue yet.

Next Steps:

  • Please let me know if this issue is still relevant to the latest version of the better-auth repository by commenting here.
  • If there is no further activity, this issue will be automatically closed in 7 days.

Thank you for your understanding and contribution!

@dosubot[bot] commented on GitHub (Jun 12, 2025): Hi, @colmanhumphrey. I'm [Dosu](https://dosu.dev), and I'm helping the better-auth team manage their backlog. I'm marking this issue as stale. **Issue Summary:** - You reported an issue with the Better Auth framework plugin. - Specifying a field type as "number" results in an integer type being generated. - You requested a solution to specify float types directly to avoid manual schema edits. - There have been no comments or activity on this issue yet. **Next Steps:** - Please let me know if this issue is still relevant to the latest version of the better-auth repository by commenting here. - If there is no further activity, this issue will be automatically closed in 7 days. Thank you for your understanding and contribution!
Author
Owner

@colmanhumphrey commented on GitHub (Jun 13, 2025):

Yes, this is still an issue, as the docs show, there still aren't any types for floats or decimals: https://www.better-auth.com/docs/concepts/plugins.

@colmanhumphrey commented on GitHub (Jun 13, 2025): Yes, this is still an issue, as the docs show, there still aren't any types for floats or decimals: https://www.better-auth.com/docs/concepts/plugins.
Author
Owner

@dosubot[bot] commented on GitHub (Sep 12, 2025):

Hi, @colmanhumphrey. I'm Dosu, and I'm helping the better-auth team manage their backlog and am marking this issue as stale.

Issue Summary:

  • You requested support for floating-point types (real or decimal) in plugin schemas.
  • Currently, the "number" type only generates integer fields with drizzle-orm.
  • You confirmed the issue persists and noted the documentation still lacks float or decimal types.
  • No further updates or progress have been made on this issue recently.

Next Steps:

  • Please let me know if this issue is still relevant with the latest version of better-auth by commenting here.
  • If I don’t hear back within 7 days, this issue will be automatically closed.

Thanks for your understanding and contribution!

@dosubot[bot] commented on GitHub (Sep 12, 2025): Hi, @colmanhumphrey. I'm [Dosu](https://dosu.dev), and I'm helping the better-auth team manage their backlog and am marking this issue as stale. **Issue Summary:** - You requested support for floating-point types (real or decimal) in plugin schemas. - Currently, the "number" type only generates integer fields with drizzle-orm. - You confirmed the issue persists and noted the documentation still lacks float or decimal types. - No further updates or progress have been made on this issue recently. **Next Steps:** - Please let me know if this issue is still relevant with the latest version of better-auth by commenting here. - If I don’t hear back within 7 days, this issue will be automatically closed. Thanks for your understanding and contribution!
Author
Owner

@colmanhumphrey commented on GitHub (Sep 24, 2025):

Still an issue

@colmanhumphrey commented on GitHub (Sep 24, 2025): Still an issue
Author
Owner

@dosubot[bot] commented on GitHub (Sep 24, 2025):

@Bekacru The user colmanhumphrey has indicated that this issue is still relevant despite being marked stale and closed. Could you please take a look and assist?

@dosubot[bot] commented on GitHub (Sep 24, 2025): @Bekacru The user colmanhumphrey has indicated that this issue is still relevant despite being marked stale and closed. Could you please take a look and assist?
Author
Owner

@0x3dev commented on GitHub (Oct 12, 2025):

yes float type would be very useful

@0x3dev commented on GitHub (Oct 12, 2025): yes float type would be very useful
Author
Owner

@dosubot[bot] commented on GitHub (Jan 11, 2026):

Hi, @colmanhumphrey. I'm Dosu, and I'm helping the better-auth team manage their backlog and am marking this issue as stale.

Issue Summary:

  • You requested support for floating-point types (like real or decimal) in plugin-generated schemas, as the current "number" type only produces integers with drizzle-orm.
  • Despite reminders and stale warnings, the issue remains unresolved and relevant.
  • Both you and another user, 0x3dev, have confirmed the need for float type support.
  • I have asked Bekacru to review and assist with this issue.
  • No progress or fixes have been reported so far.

Next Steps:

  • Please let us know if this issue is still relevant to the latest version of better-auth by commenting here to keep the discussion open.
  • Otherwise, this issue will be automatically closed in 7 days.

Thank you for your understanding and contribution!

@dosubot[bot] commented on GitHub (Jan 11, 2026): Hi, @colmanhumphrey. I'm [Dosu](https://dosu.dev), and I'm helping the better-auth team manage their backlog and am marking this issue as stale. **Issue Summary:** - You requested support for floating-point types (like real or decimal) in plugin-generated schemas, as the current "number" type only produces integers with drizzle-orm. - Despite reminders and stale warnings, the issue remains unresolved and relevant. - Both you and another user, 0x3dev, have confirmed the need for float type support. - I have asked Bekacru to review and assist with this issue. - No progress or fixes have been reported so far. **Next Steps:** - Please let us know if this issue is still relevant to the latest version of better-auth by commenting here to keep the discussion open. - Otherwise, this issue will be automatically closed in 7 days. Thank you for your understanding and contribution!
Author
Owner

@colmanhumphrey commented on GitHub (Jan 11, 2026):

Yes looks to be!

@colmanhumphrey commented on GitHub (Jan 11, 2026): Yes looks to be!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#541