MismatchedTokenException: Expecting --> '}' <-- but found --> 'model' <--
gogoout opened this issue · 0 comments
gogoout commented
Hi, thanks for the great work. When I parse my schema with the parser, it will throw this error because we have model
as one of our table's field name.
To reproduce, just parse this schema:
// https://www.prisma.io/docs/concepts/components/prisma-schema
// added some fields to test keyword ambiguous
datasource db {
url = env("DATABASE_URL")
provider = "postgresql"
}
generator client {
provider = "prisma-client-js"
}
model User {
id Int @id @default(autoincrement())
createdAt DateTime @default(now())
email String @unique
name String?
role Role @default(USER)
posts Post[]
}
model Post {
id Int @id @default(autoincrement())
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
published Boolean @default(false)
title String @db.VarChar(255)
author User? @relation(fields: [authorId], references: [id])
authorId Int?
// keyword test
model String
generator String
datasource String
enum String
}
enum Role {
USER
ADMIN
}