feat: Add remapColumnsToCamelCase option#39
Open
bigx333 wants to merge 2 commits intoPassionfroot:mainfrom
Open
feat: Add remapColumnsToCamelCase option#39bigx333 wants to merge 2 commits intoPassionfroot:mainfrom
bigx333 wants to merge 2 commits intoPassionfroot:mainfrom
Conversation
Adds a new generator option `remapColumnsToCamelCase` that allows users to automatically convert Prisma field names (database columns) to camelCase in the generated Zero schema. This includes: - Adding the boolean option to the config. - Implementing the remapping logic in `schemaMapper.ts`, handling primary keys, foreign keys, and `@map` attributes consistently with the existing `remapTablesToCamelCase` behavior. - Adding comprehensive unit tests for the mapping logic. - Updating generator snapshots. - Documenting the new option in the README.
|
Would be great if someone could look at this PR. It's a much needed feature addition. Sucks to have to do this by hand with the generated types. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds a new generator option
remapColumnsToCamelCasethat allows users to automatically convert Prisma field names (database columns) to camelCase in the generated Zero schema.This includes:
schemaMapper.ts, handling primary keys, foreign keys, and@mapattributes consistently with the existingremapTablesToCamelCasebehavior.certain columns will still have underlines (per example primary_key_part_1 becomes primaryKeypart_1) due to the change-case logic but for consistency I kept the same behaviour as the tables.