sendou.ink/prisma/schema.prisma
2020-12-25 13:34:27 +02:00

233 lines
4.7 KiB
Plaintext

datasource db {
provider = "postgresql"
// TODO: 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?
builds Build[]
submittedRecords SalmonRunRecord[]
salmonRunRecords SalmonRunRecord[] @relation("SalmonRunRecordRoster")
freeAgentPost FreeAgentPost?
}
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
}
enum Mode {
TW
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])
}
enum Region {
EU
NA
JP
}
enum LeagueType {
TWIN
QUAD
}
model LeagueSquad {
id Int @id @default(autoincrement())
region Region
type LeagueType
leaguePower Float
startTime DateTime
members LeagueSquadMember[]
@@index([leaguePower, type, region])
}
model LeagueSquadMember {
squadId Int
squad LeagueSquad @relation(fields: [squadId], references: [id])
switchAccountId String
player Player @relation(fields: [switchAccountId], references: [switchAccountId])
weapon String
@@unique([squadId, switchAccountId])
}
model Player {
switchAccountId String @unique
userId Int? @unique
name String?
placements XRankPlacement[]
user User? @relation(fields: [userId], references: [id])
leaguePlacements LeagueSquadMember[]
}
enum Ability {
CB
LDE
OG
T
H
NS
TI
RP
AD
DR
SJ
OS
BDU
REC
RES
ISM
ISS
MPU
QR
QSJ
RSU
SSU
SCU
SPU
SS
BRU
}
model Build {
id Int @id @default(autoincrement())
userId Int
weapon String
title String?
description String?
modes Mode[]
headGear String?
headAbilities Ability[]
clothingGear String?
clothingAbilities Ability[]
shoesGear String?
shoesAbilities Ability[]
abilityPoints Json
top500 Boolean
jpn Boolean
updatedAt DateTime @updatedAt
user User @relation(fields: [userId], references: [id])
@@index(weapon)
@@index(userId)
@@index(abilityPoints)
}
model SalmonRunRotation {
id Int @unique
startTime DateTime
endTime DateTime
weapons String[]
grizzcoWeapon String?
stage String
records SalmonRunRecord[]
}
enum SalmonRunRecordCategory {
TOTAL
TOTAL_NO_NIGHT
PRINCESS
NT_NORMAL
HT_NORMAL
LT_NORMAL
NT_RUSH
HT_RUSH
NT_FOG
HT_FOG
LT_FOG
NT_GOLDIE
HT_GOLDIE
NT_GRILLERS
HT_GRILLERS
NT_MOTHERSHIP
HT_MOTHERSHIP
LT_MOTHERSHIP
LT_COHOCK
}
model SalmonRunRecord {
id Int @id @default(autoincrement())
rotationId Int
submitterId Int
goldenEggCount Int
approved Boolean
category SalmonRunRecordCategory
links String[]
createdAt DateTime @default(now())
rotation SalmonRunRotation @relation(fields: [rotationId], references: [id])
submitter User @relation(fields: [submitterId], references: [id])
roster User[] @relation("SalmonRunRecordRoster")
}
enum VoiceChatStatus {
YES
NO
MAYBE
}
enum Playstyle {
FRONTLINE
MIDLINE
BACKLINE
}
model FreeAgentPost {
id Int @id @default(autoincrement())
playstyles Playstyle[]
canVC VoiceChatStatus
content String
updatedAt DateTime @updatedAt
userId Int @unique
user User @relation(fields: [userId], references: [id])
likedPosts FreeAgentPost[] @relation("LikedPosts", references: [id])
likersPosts FreeAgentPost[] @relation("LikedPosts", references: [id])
}