Skip to content

fix(vef-cli): use bun's Underscore for derived schema column names#2

Open
zouanbing wants to merge 1 commit into
coldsmirk:mainfrom
zouanbing:fix/modelschema-derived-column-underscore
Open

fix(vef-cli): use bun's Underscore for derived schema column names#2
zouanbing wants to merge 1 commit into
coldsmirk:mainfrom
zouanbing:fix/modelschema-derived-column-underscore

Conversation

@zouanbing

Copy link
Copy Markdown
Contributor

extractColumnNameFromTag fell back to lo.SnakeCase when a field had no explicit column name (e.g. bun:"type:jsonb" or bun:",nullzero"). lo.SnakeCase inserts an underscore before digits (Name2 -> name_2), but bun derives the column with internal.Underscore, which does not (Name2 -> name2). The generated accessor then referenced a column that does not exist for any field whose name contains a digit.

Replace the fallback with a local copy of bun's Underscore so generated column names match the columns bun reads and writes at runtime.

extractColumnNameFromTag fell back to lo.SnakeCase when a field had no
explicit column name (e.g. `bun:"type:jsonb"` or `bun:",nullzero"`).
lo.SnakeCase inserts an underscore before digits (Name2 -> name_2), but
bun derives the column with internal.Underscore, which does not
(Name2 -> name2). The generated accessor then referenced a column that
does not exist for any field whose name contains a digit.

Replace the fallback with a local copy of bun's Underscore so generated
column names match the columns bun reads and writes at runtime.
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