generator client { provider = "prisma-client-js" } datasource db { provider = "postgresql" url = env("DATABASE_URL") } model User { id Int @id @default(autoincrement()) username String @unique password String salt String email String @unique sessions Session[] scores Score[] } model Session { id String @id @default(cuid()) userId Int user User @relation(fields: [userId], references: [id], onDelete: Cascade) createdAt DateTime @default(now()) expiresAt DateTime } model Game { internalName String @id formattedName String @unique description String scores Score[] charts Charts[] } model Score { id Int @id @default(autoincrement()) // This is the numerical score number (global) gameInternalName String chartId String // Refers to the unqiue chart identifier userId Int timestamp BigInt // in UNIX milliseconds data Json game Game @relation(fields: [gameInternalName], references: [internalName]) user User @relation(fields: [userId], references: [id]) chart Charts @relation(fields: [chartId], references: [chartId]) } model Charts { chartId String @id // platform-wide unique hash gameInternalName String title String artist String game Game @relation(fields: [gameInternalName], references: [internalName]) scores Score[] }