| 1 | generator client {
|
| 2 | provider = "prisma-client-js"
|
| 3 | //output = "../src/generated/prisma"
|
| 4 | }
|
| 5 |
|
| 6 | datasource db {
|
| 7 | provider = "postgresql"
|
| 8 | }
|
| 9 |
|
| 10 | model User {
|
| 11 | id Int @id @default(autoincrement())
|
| 12 | firstName String @map("first_name")
|
| 13 | lastName String? @map("last_name")
|
| 14 | email String @unique
|
| 15 | encryptedPassword String @map("encrypted_password")
|
| 16 | passwordResetToken String? @map("password_reset_token")
|
| 17 | passwordResetExpires DateTime? @map("password_reset_expires")
|
| 18 | createdAt DateTime @default(now()) @map("created_at")
|
| 19 | updatedAt DateTime @updatedAt @map("updated_at")
|
| 20 |
|
| 21 | moods Mood[]
|
| 22 | interventions Intervention[]
|
| 23 | triggers Trigger[]
|
| 24 |
|
| 25 | @@map("users")
|
| 26 | }
|
| 27 |
|
| 28 | model Mood {
|
| 29 | id Int @id @default(autoincrement())
|
| 30 | description String? @db.Text
|
| 31 | moment DateTime @default(now())
|
| 32 | anxietyLevel Int @map("anxiety_level")
|
| 33 | stressLevel Int @map("stress_level")
|
| 34 | energyLevel Int @map("energy_level")
|
| 35 | userId Int @map("user_id")
|
| 36 | user User @relation(fields: [userId], references: [id])
|
| 37 |
|
| 38 | moodComponents MoodComponent[]
|
| 39 |
|
| 40 | @@map("moods")
|
| 41 | }
|
| 42 |
|
| 43 | model MoodComponent {
|
| 44 | id Int @id @default(autoincrement())
|
| 45 | comment String?
|
| 46 | intensity IntensityLevel @default(LIGHT)
|
| 47 |
|
| 48 | moodId Int @map("mood_id")
|
| 49 | mood Mood @relation(fields: [moodId], references: [id])
|
| 50 |
|
| 51 | @@map("mood_components")
|
| 52 | }
|
| 53 |
|
| 54 | model Intervention {
|
| 55 | id Int @id @default(autoincrement())
|
| 56 | comment String?
|
| 57 | interventionType InterventionType @map("intervention_type")
|
| 58 | eficacy Int
|
| 59 | startAt DateTime @map("start_at")
|
| 60 | endAt DateTime @map("end_at")
|
| 61 |
|
| 62 | userId Int @map("user_id")
|
| 63 | user User @relation(fields: [userId], references: [id])
|
| 64 |
|
| 65 | @@map("interventions")
|
| 66 | }
|
| 67 |
|
| 68 | model Trigger {
|
| 69 | id Int @id @default(autoincrement())
|
| 70 | comment String? @db.Text
|
| 71 | category TriggerType
|
| 72 |
|
| 73 | userId Int @map("user_id")
|
| 74 | user User @relation(fields: [userId], references: [id])
|
| 75 |
|
| 76 | @@map("triggers")
|
| 77 | }
|
| 78 |
|
| 79 | enum IntensityLevel {
|
| 80 | LIGHT
|
| 81 | MODERATE
|
| 82 | HIGH
|
| 83 | }
|
| 84 |
|
| 85 | enum InterventionType {
|
| 86 | MEDICATION
|
| 87 | THERAPY
|
| 88 | MEDITATION
|
| 89 | EXERCISE
|
| 90 | CONVERSATION
|
| 91 | }
|
| 92 |
|
| 93 | enum TriggerType {
|
| 94 | SOCIAL
|
| 95 | ENVIRONMENTAL
|
| 96 | EMOTIONAL
|
| 97 | PHYSICAL
|
| 98 | OTHER
|
| 99 | }
|