aboutsummaryrefslogtreecommitdiffstats
path: root/tests/query/highlights/prisma/test.prisma
blob: 5517e9eb52700910df61009c5bb49ca448dcebe8 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
generator client {
// ^ keyword
  provider = "go run github.com/prisma/prisma-client-go"
  // ^ variable
}

datasource db {
  provider = "postgresql"
  //           ^ string
  url      = env("DATABASE_URL")
  //          ^ function
}

model User {
  email      String
  //          ^ type
  username   String   @id
  //                  ^ operator
  password   String
  fullName   String   @map("full_name")
  //                    ^ function
  avatarUrl  String   @map("avatar_url")
  about      String?
  //               ^ type
  createdAt  DateTime @default(now()) @map("created_at")
  updatedAt  DateTime @updatedAt @map("updated_at")

  @@map("user")
}

model Reaction {
  //           ^ punctuation.bracket
  id        Int      @id @default(autoincrement())
  //                             ^ punctuation.bracket
  postId    Int      @map("post_id")
  userId    String   @map("user_id")
  type      ReactionType
  createdAt DateTime @default(now()) @map("created_at")
  updatedAt DateTime @updatedAt @map("updated_at")

  post      Post     @relation(fields: [postId], references: [id])
  //                             ^ property
  user      User     @relation(fields: [userId], references: [username])
  //                                   ^ punctuation.bracket

  @@map("reaction")
}

enum ReactionType {
// ^ keyword.type
  LIKE
  HAHA
  SAD
  ANGRY
  // ^ constant
}

view ReactionView {
// ^ keyword
  id     Int @unique
  postId Int
  userId String
}