Skip to content
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

MismatchedTokenException: Expecting --> '}' <-- but found --> 'model' <-- #5

Closed
gogoout opened this issue Dec 30, 2021 · 0 comments · Fixed by #6
Closed

MismatchedTokenException: Expecting --> '}' <-- but found --> 'model' <-- #5

gogoout opened this issue Dec 30, 2021 · 0 comments · Fixed by #6

Comments

@gogoout
Copy link
Contributor

gogoout commented Dec 30, 2021

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
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant