Skip to content

fix(drizzle-seed): apply db casing to pg_get_serial_sequence column name#5473

Open
sleitor wants to merge 1 commit intodrizzle-team:betafrom
sleitor:fix-5470
Open

fix(drizzle-seed): apply db casing to pg_get_serial_sequence column name#5473
sleitor wants to merge 1 commit intodrizzle-team:betafrom
sleitor:fix-5470

Conversation

@sleitor
Copy link
Copy Markdown

@sleitor sleitor commented Mar 12, 2026

What's changed

When a Drizzle database is configured with casing: 'snake_case', columns defined without an explicit column name (i.e. keyAsName: true) have their .name set to the JS property key (camelCase). The dialect's CasingCache is responsible for converting these to the actual DB column names.

Previously, updateColumnSequence used column.name directly in the pg_get_serial_sequence call, causing it to pass the camelCase name (e.g. 'multiWordInt') instead of the snake_case DB name ('multi_word_int'), resulting in a runtime error for any multi-word integer-like column when seeding.

Fix: Retrieve the db dialect's CasingCache and use getColumnCasing(column) to obtain the actual DB column name before storing it in columnsToUpdateSeq.

Fixes #5470

Type of change

  • Bug fix (non-breaking change which fixes an issue)

When a Drizzle database is configured with casing: 'snake_case', columns
defined with keyAsName:true (i.e. no explicit column name) have a .name
equal to the JS property key (camelCase). The dialect's CasingCache is
responsible for converting these to the actual DB column names.

Previously, updateColumnSequence used column.name directly in the
pg_get_serial_sequence call, causing it to pass the camelCase name
(e.g. 'multiWordInt') instead of the snake_case DB name ('multi_word_int'),
resulting in a runtime error for any multi-word integer-like column.

Fix: retrieve the db dialect's CasingCache and use getColumnCasing(column)
to obtain the actual DB column name before storing it in columnsToUpdateSeq.

Fixes drizzle-team#5470
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant