generator client { provider = "prisma-client-js" output = "../node_modules/.prisma/client" } datasource db { provider = "sqlite" url = env("DATABASE_URL") } model User { id String @id @default(cuid()) email String @unique password String name String role String @default("PLAYER") predictions Prediction[] createdAt DateTime @default(now()) updatedAt DateTime @updatedAt } model Team { id String @id @default(cuid()) name String shortName String @unique isoCode String @unique group String groupOrder Int confederation String homeMatches Match[] @relation("HomeTeam") awayMatches Match[] @relation("AwayTeam") @@index([group]) } model Match { id String @id @default(cuid()) matchNumber Int @unique phase String group String? matchday Int? homeTeam Team? @relation("HomeTeam", fields: [homeTeamId], references: [id]) homeTeamId String? awayTeam Team? @relation("AwayTeam", fields: [awayTeamId], references: [id]) awayTeamId String? homeLabel String? awayLabel String? scheduledAt DateTime venue String? homeScore Int? awayScore Int? status String @default("SCHEDULED") predictions Prediction[] createdAt DateTime @default(now()) updatedAt DateTime @updatedAt @@index([phase]) @@index([group]) @@index([status]) @@index([scheduledAt]) } model Prediction { id String @id @default(cuid()) user User @relation(fields: [userId], references: [id]) userId String match Match @relation(fields: [matchId], references: [id]) matchId String result String points Int? createdAt DateTime @default(now()) updatedAt DateTime @updatedAt @@unique([userId, matchId]) @@index([userId]) @@index([matchId]) }