Skip to content

Comments

feat: Add remapColumnsToCamelCase option#39

Open
bigx333 wants to merge 2 commits intoPassionfroot:mainfrom
bigx333:feat/remap-columns-camelcase
Open

feat: Add remapColumnsToCamelCase option#39
bigx333 wants to merge 2 commits intoPassionfroot:mainfrom
bigx333:feat/remap-columns-camelcase

Conversation

@bigx333
Copy link

@bigx333 bigx333 commented Apr 29, 2025

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.

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.

bigx333 added 2 commits April 29, 2025 03:10
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.
@miketbai
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants