generator client { provider = "prisma-client-js" } datasource db { provider = "postgresql" url = env("DATABASE_URL") } model Parent { id String @id @default(cuid()) email String @unique name String? emailVerified Boolean @default(false) image String? createdAt DateTime @default(now()) updatedAt DateTime @updatedAt familyId String family Family @relation(fields: [familyId], references: [id]) sessions Session[] accounts Account[] } model Session { id String @id @default(cuid()) email String? userId String? parentId String? parent Parent? @relation(fields: [parentId], references: [id]) token String @unique expiresAt DateTime ipAddress String? userAgent String? createdAt DateTime @default(now()) updatedAt DateTime @updatedAt } model Account { id String @id @default(cuid()) accountId String providerId String parentId String parent Parent @relation(fields: [parentId], references: [id]) accessToken String? refreshToken String? idToken String? accessTokenExpiresAt DateTime? scope String? password String? createdAt DateTime @default(now()) updatedAt DateTime @updatedAt } model Verification { id String @id @default(cuid()) identifier String value String expiresAt DateTime createdAt DateTime @default(now()) updatedAt DateTime @updatedAt } model Family { id String @id @default(cuid()) name String? createdAt DateTime @default(now()) updatedAt DateTime @updatedAt parents Parent[] children Child[] } model Child { id String @id @default(cuid()) name String? avatar String? birthdate DateTime? profileNotes String? createdAt DateTime @default(now()) updatedAt DateTime @updatedAt familyId String family Family @relation(fields: [familyId], references: [id]) devices Device[] sessions SessionLog[] fsrsCards FsrsCard[] milestones Milestone[] } model Device { id String @id @default(cuid()) deviceFingerprint String pairedAt DateTime @default(now()) lastSeen DateTime @updatedAt role String @default("child") createdAt DateTime @default(now()) childId String child Child @relation(fields: [childId], references: [id]) } model SessionLog { id String @id @default(cuid()) startedAt DateTime @default(now()) endedAt DateTime? durationSec Int? skillsPracticed String? childId String child Child @relation(fields: [childId], references: [id]) skillAttempts SkillAttempt[] } model SkillAttempt { id String @id @default(cuid()) skillCode String promptLevel Int @default(0) correct Boolean responseMs Int? createdAt DateTime @default(now()) sessionLogId String sessionLog SessionLog @relation(fields: [sessionLogId], references: [id]) } model FsrsCard { id String @id @default(cuid()) skillCode String dueAt DateTime @default(now()) stability Float @default(0) difficulty Float @default(0) reps Int @default(0) lapses Int @default(0) createdAt DateTime @default(now()) updatedAt DateTime @updatedAt childId String child Child @relation(fields: [childId], references: [id]) } model Milestone { id String @id @default(cuid()) skillCode String reachedAt DateTime @default(now()) childId String child Child @relation(fields: [childId], references: [id]) }