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
Casing for Prisma Client model and field names #5035
Comments
Re-opening as we've undone this decision. We'll have to revisit this. |
Until we have more reportings about this, we will close this. |
This actually breaks camel case naming convention when acronyms should be capitalized, eg. we have an NFT model, it becomes |
We lowercase the first letter now. I don't think we can change that now, that will break things for existing users. |
You can try using a map: model nft {
// fields ..
// ..
@@map("NFT")
} This will provide |
@pantharshit00 thanks, I will try this. |
Yeah. In our case, one of the models name is MEPAction (as per the naming conventions it should be MEPAction, not MepAction). but the prisma code generated is prisma.mEPAction, it actually should be prisma.mepAction. Just because Prisma is generating this wierd code, we need to flout the naming conventions and use MepAction instead of MEPAction.
@pantharshit00 This names the database table name as nft. But the prisma code generated is still prisma.nFT |
As I already told here we can't change it. Here is the lowercase function we use: prisma/packages/client/src/runtime/utils/common.ts Lines 452 to 455 in ba74c81
It is very simple and just lowercase the first letter. It is designed so that generally convention of using Capitalized Case in Prisma schema reflects fine in the client. When you use existing database models we recommend using Changing the lowercase function also means a breaking change for all users. |
Similar to #1851, but Client level
Right now this exists: https://github.com/prisma/prisma-client-js/blob/ffa2f18bd5dc9390380f01d3f68a9c81adeb1086/packages/photon/src/runtime/getPrismaClient.ts#L349
This should be removed, and everything that is similar: The schema is the source of truth for capitalization of model and field names.
The text was updated successfully, but these errors were encountered: