sendou.ink/server/prisma/schema.prisma
2021-10-25 16:45:29 +03:00

59 lines
1.7 KiB
Plaintext

// This is your Prisma schema file,
// learn more about it in the docs: https://pris.ly/d/prisma-schema
generator client {
provider = "prisma-client-js"
}
datasource db {
provider = "postgresql"
url = env("DATABASE_URL")
}
model User {
id Int @id @default(autoincrement())
discordId String @unique
discordName String
discordDiscriminator String
discordAvatar String?
discordRefreshToken String
twitch String?
twitter String?
youtubeId String?
youtubeName String?
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
ownedOrganization Organization?
}
model Organization {
id Int @id @default(autoincrement())
name String
/// Name in lower case to show in URL
nameForUrl String @unique
ownerId Int @unique
owner User @relation(fields: [ownerId], references: [id])
discordInvite String
twitter String?
tournaments Tournament[]
}
model Tournament {
id Int @id @default(autoincrement())
name String
/// Name in lower case to show in URL
nameForUrl String
description String?
startTime DateTime
checkInTime DateTime
/// CSS for tournament banner's background value
bannerBackground String
/// CSS for tournament banner's color value
bannerTextColor String
organizerId Int
organizer Organization @relation(fields: [organizerId], references: [id])
// There might be duplicate nameForUrl's but inside an organization they're unique
@@unique([nameForUrl, organizerId])
}