sendou.ink/prisma/schema.prisma
2020-11-03 17:03:22 +02:00

65 lines
1.4 KiB
Plaintext

datasource db {
provider = "postgresql"
// FIXME: should use same .env system as Next.JS
url = env("DATABASE_URL")
}
generator client {
provider = "prisma-client-js"
}
model User {
id Int @id @default(autoincrement())
username String
discriminator String
discordId String @unique
discordAvatar String?
profile Profile?
player Player?
}
model Profile {
twitterName String?
twitchName String?
youtubeId String?
country String?
sensMotion Float?
sensStick Float?
bio String?
weaponPool String[]
customUrlPath String? @unique
user User @relation(fields: [userId], references: [id])
userId Int @unique
}
enum RankedMode {
SZ
TC
RM
CB
}
model XRankPlacement {
id Int @id @default(autoincrement())
switchAccountId String
player Player @relation(fields: [switchAccountId], references: [switchAccountId])
playerName String
ranking Int
xPower Float
weapon String
mode RankedMode
month Int
year Int
@@unique([switchAccountId, mode, month, year])
}
model Player {
switchAccountId String @unique
user User? @relation(fields: [userId], references: [id])
userId Int? @unique
name String
placements XRankPlacement[]
}