prisma-generator-kysely icon indicating copy to clipboard operation
prisma-generator-kysely copied to clipboard

@@map is not supported

Open 342b45 opened this issue 1 year ago • 0 comments

Bug

The issue with the Prisma model and Prisma-generator-kysely arises when using the @@Map directive. When using @@Map, the Prisma-generator-kysely does not output types properly. Instead of using the value for the object key from @@Map, it uses the model name. This can result in inconsistencies and errors when trying to use the generated types.

To reproduce

To reproduce the issue with the Prisma model and Prisma-generator-kysely not outputting types properly when using @@Map, follow these steps:

Create a new Prisma model with a field that uses the @@Map directive, for example:

model User {
  id       Int      @id @default(autoincrement())
  username String   @unique
 @@map("users")
}

Run the Prisma-generator-kysely to generate the database schema and code for the model.

Check the generated code for the User model, specifically the TypeScript types for the fields. You may notice that the generated code uses the model field name instead of the @@Map directive value, resulting in inconsistent and incorrect types.

Attempt to use the generated code in your project, and you may encounter errors or inconsistencies due to the incorrect types.

342b45 avatar Apr 22 '23 08:04 342b45