Search code examples
prisma

Why Prisma introspection does not like my naming?


I try to introspect my existing DB to generate Prisma schema with

npx prisma db pull

I get a list of warnings like:

These enum values were commented out because their names are currently not supported by Prisma. 
Please provide valid ones that match [a-zA-Z][a-zA-Z0-9_]* using the `@map` attribute:
  - Enum: "orderstatus_type", value: "0"

I don't see what's wrong with my naming. Is there something?


Solution

  • The constraints apply to both names and values. I suggest running prisma db pull first, then manually adjusting the schema after introspection.

    You can create mappings like this:

    enum OrderStatusType @@map("orderstatus_type"){
      Zero @map("0")
    }
    

    In this way, the generated type adheres to CamelCase and complies with the regex specified in the error message.