generator client { provider = "prisma-client-js" binaryTargets = ["native", "linux-musl-openssl-3.0.x"] } datasource db { provider = "postgresql" url = env("DATABASE_URL") } /// A member account, created on email+password signup or Google sign-in — /// same dual-path pattern as LokiLab (lib/member-password.ts / google-oauth.ts). model User { id String @id @default(cuid()) email String @unique name String avatarUrl String? googleSub String? @unique /// scrypt hash, format `scrypt$$`. Null when the account was /// created via Google only. passwordHash String? /// Shown instead of name/email anywhere this member's activity is public /// (leaderboard, follow counts). Must be set before a member appears /// publicly. publicNickname String? /// Last country tab the member viewed, restored on next visit. favoriteCountry String @default("CA-QC") createdAt DateTime @default(now()) updatedAt DateTime @updatedAt follows FollowedPick[] } /// A member "following" one of Loki's picks for a specific upcoming draw — /// the leaderboard is built from how many of these resolve as wins. No /// money, no pooled play: this only records that a member said "I'm /// tracking this one," same spirit as LokiLab's "je joue aussi" copy but /// without a numbers payload (the pick itself lives in LokiLab's feed). model FollowedPick { id String @id @default(cuid()) userId String user User @relation(fields: [userId], references: [id], onDelete: Cascade) /// Matches LokiLab's lottery id (e.g. "lotto-max", "q4"). lotteryId String country String targetDrawDate String createdAt DateTime @default(now()) @@unique([userId, lotteryId, targetDrawDate]) @@index([userId]) @@index([lotteryId, targetDrawDate]) }