38 lines
674 B
Text
38 lines
674 B
Text
datasource db {
|
|
url = env("DATABASE_FILE")
|
|
provider = "sqlite"
|
|
}
|
|
|
|
generator client {
|
|
provider = "prisma-client-js"
|
|
}
|
|
|
|
model Game {
|
|
id String @id @default(cuid())
|
|
lobbyCodeIfActive String? @unique
|
|
|
|
actions GameAction[]
|
|
}
|
|
|
|
model Player {
|
|
id String @id @default(cuid())
|
|
name String
|
|
token String @unique
|
|
|
|
gameActions GameAction[]
|
|
}
|
|
|
|
model GameAction {
|
|
id String @id @default(cuid())
|
|
|
|
index Int
|
|
gameId String
|
|
game Game @relation(references: [id], fields: [gameId])
|
|
|
|
playerId String? // null → the server
|
|
player Player? @relation(references: [id], fields: [playerId])
|
|
|
|
data String
|
|
|
|
@@unique([gameId, index])
|
|
}
|