Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix collection casing #1837

Closed
wants to merge 2 commits into from
Closed

Conversation

partyka1
Copy link

@partyka1 partyka1 commented Apr 3, 2022

Information

Type Breaking change
Fix No

Prisma generates collection name using lowerCase, instead of camelCase

https://github.com/prisma/prisma/blob/d7d33d896bcb104a56877fe4d87405f8200a63fc/packages/client/src/generation/TSClient/PrismaClient.ts#L225

Todos

  • Tests
  • Coverage
  • Example
  • Documentation

@@ -103,7 +107,7 @@ export function generateRepositories(dmmf: DMMF.Document, project: Project, base
.addGetAccessor({
name: "collection"
})
.setBodyText(`return this.prisma.${camelCase(model.name)}`);
.setBodyText(`return this.prisma.${lowerCase(model.name)}`);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm surprised that this fix doesn't have a change on unit test...

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't understand the difference between camelcase and this function...

@Romakita
Copy link
Collaborator

Romakita commented Apr 4, 2022

Hello @partyka1
Thanks for the PR. I let the CI replay all unit test. I'm surprised to not see any unit test impacted by your change, or a new scenario to cover this usecase in https://github.com/tsedio/tsed/blob/73f06e8f72ec0d63f9c55506b2f3fdffa52210f9/packages/orm/prisma/src/generator/utils/generateRespositories.spec.ts

Also, your commit message doesn't follow the guideline rules - see commit angular convention. (a commit hook is here to prevent that).

See you
Romain

@coveralls
Copy link

Pull Request Test Coverage Report for Build 2083791484

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • 3 unchanged lines in 1 file lost coverage.
  • Overall coverage decreased (-0.009%) to 95.236%

Files with Coverage Reduction New Missed Lines %
packages/di/src/services/InjectorService.ts 3 94.12%
Totals Coverage Status
Change from base Build 2088550580: -0.009%
Covered Lines: 3147
Relevant Lines: 3162

💛 - Coveralls

@@ -103,7 +107,7 @@ export function generateRepositories(dmmf: DMMF.Document, project: Project, base
.addGetAccessor({
name: "collection"
})
.setBodyText(`return this.prisma.${camelCase(model.name)}`);
.setBodyText(`return this.prisma.${lowerCase(model.name)}`);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't understand the difference between camelcase and this function...

@Romakita
Copy link
Collaborator

Romakita commented Apr 7, 2022

this PR #1815 fix the issue. I close this PR ;)

@Romakita Romakita closed this Apr 7, 2022
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.

3 participants