InnerVoice / prisma /schema.prisma
E5K7's picture
feat: Weekly Report — Spotify Wrapped-style emotional summary with mood arc, AI narrative, emotion breakdown, and one-click image export
8aba1e2
// Prisma schema reference (PostgreSQL target)
// For production use: npx prisma db push
generator client {
provider = "prisma-client-js"
}
datasource db {
provider = "postgresql"
url = env("DATABASE_URL")
}
model User {
id String @id @default(uuid())
email String @unique
name String
createdAt DateTime @default(now()) @map("created_at")
baselinePitch Float? @map("baseline_pitch")
baselineEnergy Float? @map("baseline_energy")
baselineSpeechRate Float? @map("baseline_speech_rate")
voiceEntries VoiceEntry[]
moodAlerts MoodAlert[]
chatMessages ChatMessage[]
@@map("users")
}
model VoiceEntry {
id String @id @default(uuid())
userId String @map("user_id")
createdAt DateTime @default(now()) @map("created_at")
audioUrl String? @map("audio_url")
durationSeconds Float? @map("duration_seconds")
transcription String?
primaryEmotion String? @map("primary_emotion")
emotionConfidence Float? @map("emotion_confidence")
energyScore Int? @map("energy_score")
calmnessScore Int? @map("calmness_score")
moodScore Int? @map("mood_score")
clarityScore Int? @map("clarity_score")
pitchMean Float? @map("pitch_mean")
pitchStd Float? @map("pitch_std")
energyRaw Float? @map("energy_raw")
speechRate Float? @map("speech_rate")
pauseCount Int? @map("pause_count")
avgPauseDuration Float? @map("avg_pause_duration")
fillerRate Float? @map("filler_rate")
mfccFeatures Json? @map("mfcc_features")
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
chatMessages ChatMessage[]
@@map("voice_entries")
}
model MoodAlert {
id String @id @default(uuid())
userId String @map("user_id")
createdAt DateTime @default(now()) @map("created_at")
alertType String @map("alert_type")
severity String
message String
isRead Boolean @default(false) @map("is_read")
suggestedAction String? @map("suggested_action")
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
@@map("mood_alerts")
}
model ChatChannel {
id String @id @default(uuid())
userId String @map("user_id")
title String @default("New Chat")
createdAt DateTime @default(now()) @map("created_at")
updatedAt DateTime @default(now()) @updatedAt @map("updated_at")
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
messages ChatMessage[]
@@map("chat_channels")
}
model ChatMessage {
id String @id @default(uuid())
userId String @map("user_id")
channelId String? @map("channel_id")
createdAt DateTime @default(now()) @map("created_at")
role String
content String
voiceEntryId String? @map("voice_entry_id")
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
channel ChatChannel? @relation(fields: [channelId], references: [id], onDelete: Cascade)
voiceEntry VoiceEntry? @relation(fields: [voiceEntryId], references: [id])
@@map("chat_messages")
}