Two-worded Pascal case table names are converted to lower case during generation
Closed this issue · 1 comments
Victor-Daniel-M commented
Bug description
In the file schema.prisma
I had the model as below
model AccessToken {
id String @id @unique @default(cuid())
expiresAt DateTime
user User? @relation(fields: [userId], references: [id])
userId String?
}
After running Prisma generate, the generated functions have an accessor as accesstoken
instead of accessToken
as shown below
export const accessTokensRouter = createRouter()
.query('findUniqueAccessToken', {
input: AccessTokenFindUniqueSchema,
async resolve({ ctx, input }) {
const findUniqueAccessToken = await ctx.prisma.accesstoken.findUnique({
where: input.where,
});
return findUniqueAccessToken;
},
})
How to reproduce
- Add a two-worded Pascal case table name in schema.prisma
- Run
prisma generate
- See the generated accessor
Expected behavior
The generated accessors should be camel case for two-worded models.
Prisma information
datasource db {
provider = "postgresql"
url = env("DATABASE_URL")
}
generator client {
provider = "prisma-client-js"
}
generator trpc {
provider = "prisma-trpc-generator"
withMiddleware = false
withShield = false
}
model AccessToken {
id String @id @unique @default(cuid())
expiresAt DateTime
user User? @relation(fields: [userId], references: [id])
userId String?
}
model User {
id String @id @unique @default(cuid())
firstName String
lastName String
email String
AccessTokens AccessToken[]
}```
### Environment & setup
- OS: Mac OS-->
- Database: PostgreSQL
- Node.js version: v14.18.1
### Prisma Version
prisma : 4.0.0
@prisma/client : 4.0.0
Current platform : darwin
omar-dulaimi commented
@Victor-Daniel-M Should be fixed in https://github.com/omar-dulaimi/prisma-trpc-generator/releases/tag/0.2.1
Thanks for using this project.