-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathschema.prisma
More file actions
165 lines (148 loc) · 5.64 KB
/
schema.prisma
File metadata and controls
165 lines (148 loc) · 5.64 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
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
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
generator client {
provider = "prisma-client-js"
seed = "ts-node ./src/stores/prisma/seed.ts"
}
datasource db {
provider = "postgresql"
url = env("DATABASE_URL")
}
model users {
id Int @id @default(autoincrement())
username String @unique
email String @unique
password String
eth_address String?
created_at DateTime @default(now())
updated_at DateTime @updatedAt
player_id Int? @unique
players players? @relation(fields: [player_id], references: [id])
}
model gamenight {
id Int @id @default(autoincrement())
game_date DateTime @db.Date
max_slots Int
slot_price Decimal? @default(5.00) @db.Decimal(10, 2)
slots_filled Int? @default(0)
gamenightreservations gamenightreservations[]
}
model gamenightreservations {
id Int @id @default(autoincrement())
game_night_id Int?
player_id Int?
display_name String @db.VarChar(255)
reserved_at DateTime? @default(now()) @db.Timestamp(6)
gamenight gamenight? @relation(fields: [game_night_id], references: [id], onDelete: NoAction, onUpdate: NoAction)
players players? @relation(fields: [player_id], references: [id], onDelete: NoAction, onUpdate: NoAction)
}
model games {
id Int @id @default(autoincrement())
game_time DateTime @db.Timestamp(6)
team_home_id Int?
team_away_id Int?
season_id Int?
home_score Int?
away_score Int?
location String? @db.VarChar(255)
referee1 String?
referee2 String?
referee3 String?
seasons seasons? @relation(fields: [season_id], references: [id], onDelete: NoAction, onUpdate: NoAction)
away_team teams? @relation("games_team_away_idToteams", fields: [team_away_id], references: [id], onDelete: NoAction, onUpdate: NoAction)
home_team teams? @relation("games_team_home_idToteams", fields: [team_home_id], references: [id], onDelete: NoAction, onUpdate: NoAction)
playerstats playerstats[]
}
model playercredits {
id Int @id @default(autoincrement())
player_id Int?
credits Decimal @default(0.00) @db.Decimal(10, 2)
players players? @relation(fields: [player_id], references: [id], onDelete: NoAction, onUpdate: NoAction)
}
model players {
id Int @id @default(autoincrement())
first_name String @db.VarChar(255)
last_name String @db.VarChar(255)
height Int?
weight Int?
sex String? @db.VarChar(1)
birthdate DateTime @db.Date
comment String?
pic Bytes?
hidden Boolean? @default(false)
position player_position_type[]
shirt_size shirt_size_type?
userId Int? @unique
player_num String? @db.VarChar(3)
gamenightreservations gamenightreservations[]
playercredits playercredits[]
playerstats playerstats[]
teamplayers teamplayers[]
teams teams[]
user users?
}
/// This table contains check constraints and requires additional setup for migrations. Visit https://pris.ly/d/check-constraints for more info.
model playerstats {
id Int @id @default(autoincrement())
player_id Int?
game_id Int?
home Boolean
played Boolean
twos_attempted Int?
twos_made Int?
minutes_played Int?
threes_attempted Int?
threes_made Int?
fouls Int?
offensive_rebounds Int?
defensive_rebounds Int?
assists Int?
blocks Int?
steals Int?
freethrows_attempted Int?
freethrows_made Int?
turnovers Int?
points Int?
games games? @relation(fields: [game_id], references: [id], onDelete: NoAction, onUpdate: NoAction)
players players? @relation(fields: [player_id], references: [id], onDelete: NoAction, onUpdate: NoAction)
}
model seasons {
id Int @id @default(autoincrement())
start_date DateTime @db.Date
games games[]
teams teams[]
}
model teamplayers {
team_id Int
player_id Int
players players @relation(fields: [player_id], references: [id], onDelete: NoAction, onUpdate: NoAction)
teams teams @relation(fields: [team_id], references: [id], onDelete: NoAction, onUpdate: NoAction)
@@id([team_id, player_id])
}
model teams {
id Int @id @default(autoincrement())
team_name String @db.VarChar(255)
captain_id Int?
season_id Int?
short_name String @db.VarChar(255)
games_games_team_away_idToteams games[] @relation("games_team_away_idToteams")
games_games_team_home_idToteams games[] @relation("games_team_home_idToteams")
teamplayers teamplayers[]
players players? @relation(fields: [captain_id], references: [id], onDelete: NoAction, onUpdate: NoAction)
seasons seasons? @relation(fields: [season_id], references: [id], onDelete: NoAction, onUpdate: NoAction)
}
enum player_position_type {
PG
SG
SF
PF
C
}
enum shirt_size_type {
S
M
L
XL
XXL
XXXL
XXXXL
XXXXXL
}