63 lines
1.5 KiB
Plaintext
63 lines
1.5 KiB
Plaintext
datasource db {
|
|
provider = "postgresql"
|
|
}
|
|
|
|
generator client {
|
|
provider = "prisma-client"
|
|
output = "../src/generated/prisma"
|
|
}
|
|
|
|
enum PlayerState {
|
|
IN_ARCHIVES
|
|
LOBBY
|
|
POST_GAME
|
|
SETTING_UP_GAME
|
|
SPECTATING
|
|
START
|
|
TRYING_LEAVE
|
|
TYPING
|
|
VIEWING_ARCHIVED_POEM
|
|
WAITING_AFTER_WRITING
|
|
WAITING_TO_WRITE
|
|
WRITING
|
|
}
|
|
|
|
model Player {
|
|
playerId String @id
|
|
createdAt DateTime @default(now())
|
|
currentGame Game? @relation("playersInGame", fields: [currentGameId], references: [gameId])
|
|
currentGameId Int?
|
|
state PlayerState @default(LOBBY)
|
|
previousState PlayerState @default(LOBBY)
|
|
userName String
|
|
games Game[]
|
|
}
|
|
|
|
model Game {
|
|
gameId Int @id @default(autoincrement())
|
|
config GameConfig? @relation(fields: [gameConfigId], references: [configId])
|
|
createdAt DateTime @default(now())
|
|
joinCode String
|
|
poem Poem?
|
|
poemId Int?
|
|
gameConfigId Int?
|
|
hostPlayer Player @relation(fields: [hostPlayerId], references: [playerId])
|
|
hostPlayerId String
|
|
inProgress Boolean @default(false)
|
|
players Player[] @relation("playersInGame")
|
|
}
|
|
|
|
model GameConfig {
|
|
configId Int @id @default(autoincrement())
|
|
games Game[]
|
|
}
|
|
|
|
model Poem {
|
|
poemId Int @id @default(autoincrement())
|
|
createdAt DateTime @default(now())
|
|
game Game @relation(fields: [gameId], references: [gameId])
|
|
gameId Int @unique
|
|
finished Boolean @default(false)
|
|
lines Json
|
|
}
|