[GH-ISSUE #3195] CLI migrate does not understand varchar is string #18142

Closed
opened 2026-04-15 16:31:43 -05:00 by GiteaMirror · 2 comments
Owner

Originally created by @rebasecase on GitHub (Jun 27, 2025).
Original GitHub issue: https://github.com/better-auth/better-auth/issues/3195

e.g.

  await db.schema
    .createTable('user')
    .addColumn('id', 'uuid', (col) => col.primaryKey())
    .addColumn('name', 'varchar', (col) => col.notNull())
    .addColumn('email', 'varchar', (col) => col.notNull().unique())
    .addColumn('email_verified', 'boolean', (col) => col.notNull().defaultTo(false))
    .addColumn('image', 'varchar')
    .addColumn('created_at', 'timestamp', (col) => col.notNull())
    .addColumn('updated_at', 'timestamp', (col) => col.notNull())
    .execute();
⠋ preparing schema...2025-06-27T19:57:23.495Z WARN [Better Auth]: Field name in table user has a different type in the database. Expected string but got varchar.
2025-06-27T19:57:23.495Z WARN [Better Auth]: Field email in table user has a different type in the database. Expected string but got varchar.
2025-06-27T19:57:23.495Z WARN [Better Auth]: Field image in table user has a different type in the database. Expected string but got varchar.

Postgres kysely driver

Originally created by @rebasecase on GitHub (Jun 27, 2025). Original GitHub issue: https://github.com/better-auth/better-auth/issues/3195 e.g. ``` await db.schema .createTable('user') .addColumn('id', 'uuid', (col) => col.primaryKey()) .addColumn('name', 'varchar', (col) => col.notNull()) .addColumn('email', 'varchar', (col) => col.notNull().unique()) .addColumn('email_verified', 'boolean', (col) => col.notNull().defaultTo(false)) .addColumn('image', 'varchar') .addColumn('created_at', 'timestamp', (col) => col.notNull()) .addColumn('updated_at', 'timestamp', (col) => col.notNull()) .execute(); ``` ``` ⠋ preparing schema...2025-06-27T19:57:23.495Z WARN [Better Auth]: Field name in table user has a different type in the database. Expected string but got varchar. 2025-06-27T19:57:23.495Z WARN [Better Auth]: Field email in table user has a different type in the database. Expected string but got varchar. 2025-06-27T19:57:23.495Z WARN [Better Auth]: Field image in table user has a different type in the database. Expected string but got varchar. ``` Postgres kysely driver
GiteaMirror added the lockedbug labels 2026-04-15 16:31:44 -05:00
Author
Owner

@rebasecase commented on GitHub (Jun 28, 2025):

Additionally casing: 'snake' does nothing.

<!-- gh-comment-id:3016002980 --> @rebasecase commented on GitHub (Jun 28, 2025): Additionally `casing: 'snake'` does nothing.
Author
Owner

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

The casing: 'snake' option is documented and present in type definitions, but it isn't actually implemented in the CLI or adapters—so setting it currently has no effect on table or column naming. The only place snake_case is enforced is in the Drizzle CLI generator, where it's always hardcoded and not configurable via the casing option. There are no built-in workarounds or warnings for this right now, so if you need snake_case, you'll have to handle naming manually or use the Drizzle generator as-is. Native support for the casing option may come in a future update, but it's a no-op for now reference.

To reply, just mention @dosu.


How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other  Join Discord Share on X

<!-- gh-comment-id:3016003660 --> @dosubot[bot] commented on GitHub (Jun 28, 2025): <!-- Answer --> The `casing: 'snake'` option is documented and present in type definitions, but it isn't actually implemented in the CLI or adapters—so setting it currently has no effect on table or column naming. The only place snake_case is enforced is in the Drizzle CLI generator, where it's always hardcoded and not configurable via the `casing` option. There are no built-in workarounds or warnings for this right now, so if you need snake_case, you'll have to handle naming manually or use the Drizzle generator as-is. Native support for the `casing` option may come in a future update, but it's a no-op for now [reference](https://github.com/better-auth/better-auth/blob/e7eed8c848740fc22dc12e1b82cad8a42155249e/packages/cli/src/generators/drizzle.ts). <!-- Dosu Comment Footer --> *To reply, just mention [@dosu](https://go.dosu.dev/dosubot).* --- <sup>How did I do? [Good](https://app.dosu.dev/response-feedback/fafa7ebe-4ed4-4ad9-96ee-b333638d020e?feedback_type=great_response) | [Irrelevant](https://app.dosu.dev/response-feedback/fafa7ebe-4ed4-4ad9-96ee-b333638d020e?feedback_type=irrelevant_answer) | [Incorrect](https://app.dosu.dev/response-feedback/fafa7ebe-4ed4-4ad9-96ee-b333638d020e?feedback_type=incorrect_sources) | [Verbose](https://app.dosu.dev/response-feedback/fafa7ebe-4ed4-4ad9-96ee-b333638d020e?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/fafa7ebe-4ed4-4ad9-96ee-b333638d020e?feedback_type=hallucination) | [Report 🐛](https://app.dosu.dev/response-feedback/fafa7ebe-4ed4-4ad9-96ee-b333638d020e?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/fafa7ebe-4ed4-4ad9-96ee-b333638d020e?feedback_type=other)</sup>&nbsp;&nbsp;[![Join Discord](https://img.shields.io/badge/join-5865F2?logo=discord&logoColor=white&label=)](https://go.dosu.dev/discord-bot)&nbsp;[![Share on X](https://img.shields.io/badge/X-share-black)](https://twitter.com/intent/tweet?text=%40dosu_ai%20helped%20me%20solve%20this%20issue!&url=https%3A//github.com/better-auth/better-auth/issues/3195)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#18142