-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathschema.prisma
More file actions
41 lines (36 loc) · 1.15 KB
/
schema.prisma
File metadata and controls
41 lines (36 loc) · 1.15 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
generator client {
provider = "prisma-client-py"
partial_type_generator = "core/models/partials.py"
recursive_type_depth = 5
}
datasource db {
provider = "sqlite"
url = "file:data/server.db"
}
// User accounts
model User {
id String @id @default(uuid())
username String @unique
password String // Hashed password
createdAt DateTime @default(now())
status String @default("OFFLINE") // ONLINE, OFFLINE, IN_GAME
matches MatchPlayer[]
}
model Match {
id String @id @default(uuid())
startedAt DateTime @default(now())
endedAt DateTime?
winnerUserId String?
players MatchPlayer[]
}
model MatchPlayer {
id String @id @default(uuid())
matchId String
userId String
match Match @relation(fields: [matchId], references: [id], onDelete: Cascade)
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
isWinner Boolean @default(false)
bombsPlaced Int @default(0)
playersKilled Int @default(0) // pra um futuro com mais players.
@@unique([matchId, userId])
}