drizzle-team / drizzle-team/drizzle-orm

[BUG]: `snakeCase.table()` converts Korean column names to empty identifiers

Open
#6,082 0 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
TypeScript
Stars
35.8k
Forks
1.6k
Avg merge
2d 7h
Merged PRs (30d)
4

Description

### Report hasn't been filed before.

- [x] I have verified that the bug I'm about to report hasn't been filed before.

### What version of `drizzle-orm` are you using?

1.0.0-rc.4

### What version of `drizzle-kit` are you using?

1.0.0-rc.4

### Other packages

_No response_

### Describe the Bug

### Describe the Bug

When a column is declared with a Korean property name using `snakeCase.table()`, `drizzle-kit generate` converts the column name into an empty string. cc @hyunbinseo

The same Korean column name is preserved correctly when the table is declared with `sqliteTable()`.

#### Schema

```ts
import { int, snakeCase, sqliteTable, text } from "drizzle-orm/sqlite-core";

export const a = snakeCase.table("a", {
id: int().primaryKey(),
칼럼명: text(),
});

export const b = sqliteTable("b", {
id: int().primaryKey(),
칼럼명: text(),
});
```

#### Generated SQL

```sql
CREATE TABLE `a` (
`id` integer PRIMARY KEY,
`` text
);
--> statement-breakpoint
CREATE TABLE `b` (
`id` integer PRIMARY KEY,
`칼럼명` text
);
```

For table `a`, which uses `snakeCase.table()`, the Korean column name is converted to an empty identifier:

```sql
`` text
```

For table `b`, which uses `sqliteTable()`, the column name is generated correctly:

```sql
`칼럼명` text
```

The invalid empty identifier also causes the generated migration to fail when it is applied with `drizzle-kit migrate`.

### Expected behavior

Applying snake_case conversion should not remove Unicode characters from identifiers. Korean and other non-Latin column names should either remain unchanged or be handled without data loss.

Contributor guide

Open the contributing guide

Research direction

Start by tracing the identifier conversion used by snakeCase.table() and compare it with sqliteTable(), using the provided TypeScript schema as the reproduction. Add a regression test covering the Korean column name, then run drizzle-kit generate and migrate to confirm the generated identifier is preserved and the migration applies successfully.

Written by the indexing model from the issue text.

Assessment

Tech stack
sqlite, typescript
Domain
databases
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
70/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.