-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathschema.prisma
More file actions
61 lines (55 loc) · 1.52 KB
/
schema.prisma
File metadata and controls
61 lines (55 loc) · 1.52 KB
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
datasource db {
provider = "postgresql"
url = env("DATABASE_URL")
}
generator db {
provider = "go run github.com/prisma/prisma-client-go"
}
model User {
id String @id @default(cuid())
username String @unique
password Bytes @unique
email String @unique
bio String
role Role @default(USER)
games Game[]
comments Comment[]
scores Score[]
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
}
model Game {
id String @id @default(cuid())
title String
description String
author User @relation(fields: [authorName], references: [username])
authorName String
comments Comment[]
scores Score[]
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
}
model Comment {
id String @id @default(cuid())
content String
author User @relation(fields: [authorName], references: [username])
authorName String
game Game @relation(fields: [gameId], references: [id])
gameId String
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
}
model Score {
id String @id @default(cuid())
value Int
game Game @relation(fields: [gameId], references: [id])
gameId String
player User @relation(fields: [playerName], references: [username])
playerName String
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
}
enum Role {
USER
ADMIN
}