-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add prisma and generate schema from the existing database
- Loading branch information
Showing
3 changed files
with
223 additions
and
2 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
generator client { | ||
provider = "prisma-client-js" | ||
} | ||
|
||
datasource db { | ||
provider = "postgresql" | ||
url = env("DATABASE_URL") | ||
} | ||
|
||
model match { | ||
match_id String @db.VarChar(255) | ||
player_id String @db.VarChar(255) | ||
elo Int? | ||
timestamp DateTime? @db.Timestamp(6) | ||
kd Float? | ||
kills Int? | ||
hs Int? | ||
map String? @db.VarChar(255) | ||
game_mode String? @db.VarChar(255) | ||
win Int? | ||
score String? @db.VarChar(255) | ||
player player @relation(fields: [player_id], references: [player_id], onDelete: Cascade, onUpdate: NoAction) | ||
@@id([match_id, player_id]) | ||
@@unique([match_id, player_id], map: "match_player_id_unique") | ||
} | ||
|
||
model match_prediction { | ||
id BigInt @id @default(autoincrement()) | ||
totalMatches BigInt? @default(0) | ||
avgPredictions Float? @default(0) @db.Real | ||
winratePredictions Float? @default(0) @db.Real | ||
created_at DateTime @default(now()) @db.Timestamptz(6) | ||
updated_at DateTime @default(now()) @db.Timestamptz(6) | ||
} | ||
|
||
model player { | ||
player_id String @id @db.VarChar(255) | ||
nickname String @db.VarChar(255) | ||
elo Int | ||
lvl Int | ||
kd Json @db.Json | ||
avg Json @db.Json | ||
winrate Json @db.Json | ||
hs Json @db.Json | ||
highestElo Int? | ||
highestEloDate DateTime? @db.Date | ||
created_at DateTime @default(now()) @db.Timestamptz(6) | ||
updated_at DateTime @default(now()) @db.Timestamptz(6) | ||
previous_elo Int? | ||
in_match Boolean? @default(false) | ||
match match[] | ||
} | ||
|
||
model team { | ||
chat_id BigInt @id | ||
type String @db.VarChar(255) | ||
username String? @db.VarChar(255) | ||
first_name String? @db.VarChar(255) | ||
title String? @db.VarChar(255) | ||
name String? @db.VarChar(255) | ||
settings Json @db.Json | ||
created_at DateTime @default(now()) @db.Timestamptz(6) | ||
updated_at DateTime @default(now()) @db.Timestamptz(6) | ||
team_player team_player[] | ||
} | ||
|
||
model team_player { | ||
chat_id BigInt | ||
player_id String @db.VarChar(255) | ||
team team @relation(fields: [chat_id], references: [chat_id], onDelete: Cascade, onUpdate: NoAction, map: "team_player_chat_id_foreign") | ||
@@id([chat_id, player_id]) | ||
} | ||
|
||
model temp_prediction { | ||
match_id String @id @unique(map: "temp_prediction_match_id_unique") @db.VarChar(255) | ||
predictions Json | ||
created_at DateTime @default(now()) @db.Timestamptz(6) | ||
} |