mirror of
https://github.com/BradNut/boredgame
synced 2025-09-08 17:40:22 +00:00
153 lines
3.5 KiB
Text
153 lines
3.5 KiB
Text
// 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 = "mysql"
|
|
url = env("DATABASE_URL")
|
|
relationMode = "prisma"
|
|
}
|
|
|
|
model AuthUser {
|
|
id String @id @default(cuid())
|
|
username String @unique
|
|
email String? @unique
|
|
firstName String?
|
|
lastName String?
|
|
role Role @default(USER)
|
|
verified Boolean @default(false)
|
|
receiveEmail Boolean @default(false)
|
|
token String? @unique
|
|
createdAt DateTime @default(now()) @db.Timestamp(6)
|
|
updatedAt DateTime @updatedAt @db.Timestamp(6)
|
|
auth_session AuthSession[]
|
|
auth_key AuthKey[]
|
|
|
|
@@map("auth_user")
|
|
}
|
|
|
|
model AuthSession {
|
|
id String @id @unique
|
|
user_id String
|
|
active_expires BigInt
|
|
idle_expires BigInt
|
|
auth_user AuthUser @relation(references: [id], fields: [user_id], onDelete: Cascade)
|
|
|
|
@@index([user_id])
|
|
@@map("auth_session")
|
|
}
|
|
|
|
model AuthKey {
|
|
id String @id @unique
|
|
hashed_password String?
|
|
user_id String
|
|
primary_key Boolean
|
|
expires BigInt?
|
|
auth_user AuthUser @relation(references: [id], fields: [user_id], onDelete: Cascade)
|
|
|
|
@@index([user_id])
|
|
@@map("auth_key")
|
|
}
|
|
|
|
enum Role {
|
|
USER
|
|
ADMIN
|
|
}
|
|
|
|
model Game {
|
|
id String @id
|
|
name String
|
|
description String?
|
|
yearPublished Int?
|
|
minPlayers Int?
|
|
maxPlayers Int?
|
|
minPlaytime Int?
|
|
maxPlaytime Int?
|
|
minAge Int?
|
|
imageUrl String?
|
|
thumbUrl String?
|
|
url String?
|
|
rulesUrl String?
|
|
weightAmount Float?
|
|
weightUnits String?
|
|
bggId String?
|
|
bggUrl String?
|
|
primaryPublisher Publisher?
|
|
categories Category[]
|
|
mechanics Mechanic[]
|
|
designers Designer[]
|
|
publishers Publisher[]
|
|
artists Artist[]
|
|
names String[] @db.Array
|
|
expansions Expansion[]
|
|
|
|
@@index([game_id])
|
|
@@map("games")
|
|
}
|
|
|
|
model Publisher {
|
|
id String @id
|
|
name String
|
|
games Game[] @relation(references: [id], fields: [game_id])
|
|
primaryPublisher Game[] @relation("PrimaryPublisher")
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @updatedAt
|
|
|
|
@@map("publishers")
|
|
}
|
|
|
|
model Category {
|
|
id String @id
|
|
name String
|
|
slug String
|
|
games Game[] @relation("GameCategories")
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @updatedAt
|
|
|
|
@@map("categories")
|
|
}
|
|
|
|
model Mechanic {
|
|
id String @id
|
|
name String
|
|
games Game[] @relation("GameMechanics")
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @updatedAt
|
|
|
|
@@map("mechanics")
|
|
}
|
|
|
|
model Designer {
|
|
id String @id
|
|
name String
|
|
games Game[] @relation("GameDesigners")
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @updatedAt
|
|
|
|
@@map("designers")
|
|
}
|
|
|
|
model Artist {
|
|
id String @id
|
|
name String
|
|
games Game[] @relation("GameArtists")
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @updatedAt
|
|
|
|
@@map("artists")
|
|
}
|
|
|
|
model Expansion {
|
|
id String @id
|
|
name String
|
|
yearPublished Int?
|
|
baseGame Game? @relation("Expansions", fields: [baseGameId], references: [id])
|
|
baseGameId String?
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @updatedAt
|
|
|
|
@@map("expansions")
|
|
}
|