-
Notifications
You must be signed in to change notification settings - Fork 1
/
schema.prisma
142 lines (127 loc) · 3.66 KB
/
schema.prisma
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
generator client {
provider = "prisma-client-py"
interface = "sync"
}
datasource db {
provider = "postgresql"
url = ""
}
model Period {
id BigInt @id
gametime Float
scoreRed Int
scoreBlue Int
possessionRed Int
possessionBlue Int
actionZoneRed Int
actionZoneBlue Int
PlayerStats PlayerStats[]
LeagueMatch LeagueMatch? @relation(fields: [leagueMatchId], references: [id])
leagueMatchId Int?
}
model Player {
id String @id @default(cuid())
auth String
conn String
name String
team Int
goalDetail GoalDetail[]
stats PlayerStats[]
}
model Goal {
id String @id @default(cuid())
time Float
passes Int
detail GoalDetail[]
}
model GoalDetail {
goal Goal @relation(fields: [goalId], references: [id])
player Player @relation(fields: [playerId], references: [id])
goalId String
playerId String
role Int
own Boolean
@@id([goalId, playerId])
}
model PlayerStats {
id String @id @default(cuid())
period Period @relation(fields: [periodId], references: [id], onDelete: Cascade)
periodId BigInt
Player Player @relation(fields: [playerId], references: [id], onDelete: Cascade)
playerId String
gametime Float
goals Int
ownGoals Int
assists Int
secondaryAssists Int
tertiaryAssists Int
shots Int
shotsTarget Int
saves Int
touches Int
kicks Int
interceptions Int
clears Int
duels Int
reboundDribbles Int
passesAttempted Int
passesSuccessful Int
goalsScoredTeam Int
goalsConcededTeam Int
averagePosX Float
averagePosY Float
gamePosition Int
}
model LeagueDivision {
id Int @id @default(autoincrement())
name String @unique
teams LeagueTeam[]
matches LeagueMatch[]
}
model LeagueTeam {
id Int @id @default(autoincrement())
division LeagueDivision @relation(fields: [leagueDivisionId], references: [id], onDelete: Cascade)
leagueDivisionId Int
name String @unique
initials String
players LeaguePlayerTeams[]
matchDetails LeagueMatchDetail[]
}
model LeaguePlayer {
id Int @id @default(autoincrement())
name String @unique
nicks String[]
teams LeaguePlayerTeams[]
}
model LeaguePlayerTeams {
player LeaguePlayer @relation(fields: [leaguePlayerId], references: [id], onDelete: Cascade)
leaguePlayerId Int
team LeagueTeam @relation(fields: [leagueTeamId], references: [id], onDelete: Cascade)
leagueTeamId Int
active Boolean
@@id([leaguePlayerId, leagueTeamId])
}
model LeagueMatch {
id Int @id
date DateTime
matchday String
gameNumber Int
title String
LeagueDivision LeagueDivision @relation(fields: [leagueDivisionId], references: [id], onDelete: Cascade)
leagueDivisionId Int
periods Period[]
defwin Int
addRed Int
addBlue Int
replayURL String
detail LeagueMatchDetail[]
}
model LeagueMatchDetail {
match LeagueMatch @relation(fields: [leagueMatchId], references: [id], onDelete: Cascade)
leagueMatchId Int
team LeagueTeam @relation(fields: [leagueTeamId], references: [id], onDelete: Cascade)
leagueTeamId Int
home Boolean
startsRed Boolean
@@id([leagueMatchId, leagueTeamId])
}