| 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 | reminders Reminder[]
|
| 25 |
|
| 26 | @@map("users")
|
| 27 | }
|
| 28 |
|
| 29 | model Mood {
|
| 30 | id Int @id @default(autoincrement())
|
| 31 | description String? @db.Text
|
| 32 | moment DateTime @default(now())
|
| 33 | anxietyLevel Int @map("anxiety_level")
|
| 34 | stressLevel Int @map("stress_level")
|
| 35 | energyLevel Int @map("energy_level")
|
| 36 | userId Int @map("user_id")
|
| 37 | user User @relation(fields: [userId], references: [id])
|
| 38 |
|
| 39 | moodComponents MoodComponent[]
|
| 40 |
|
| 41 | @@map("moods")
|
| 42 | }
|
| 43 |
|
| 44 | model MoodComponent {
|
| 45 | id Int @id @default(autoincrement())
|
| 46 | comment String?
|
| 47 | intensity IntensityLevel @default(LIGHT)
|
| 48 |
|
| 49 | moodId Int @map("mood_id")
|
| 50 | mood Mood @relation(fields: [moodId], references: [id])
|
| 51 |
|
| 52 | @@map("mood_components")
|
| 53 | }
|
| 54 |
|
| 55 | model Intervention {
|
| 56 | id Int @id @default(autoincrement())
|
| 57 | comment String?
|
| 58 | interventionType InterventionType @map("intervention_type")
|
| 59 | eficacy Int
|
| 60 | startAt DateTime @map("start_at")
|
| 61 | endAt DateTime @map("end_at")
|
| 62 |
|
| 63 | userId Int @map("user_id")
|
| 64 | user User @relation(fields: [userId], references: [id])
|
| 65 |
|
| 66 | @@map("interventions")
|
| 67 | }
|
| 68 |
|
| 69 | model Trigger {
|
| 70 | id Int @id @default(autoincrement())
|
| 71 | comment String? @db.Text
|
| 72 | category TriggerType
|
| 73 |
|
| 74 | userId Int @map("user_id")
|
| 75 | user User @relation(fields: [userId], references: [id])
|
| 76 |
|
| 77 | @@map("triggers")
|
| 78 | }
|
| 79 |
|
| 80 | model Reminder {
|
| 81 | id Int @id @default(autoincrement())
|
| 82 | hour Int
|
| 83 | minute Int
|
| 84 | description String?
|
| 85 | active Boolean @default(false)
|
| 86 |
|
| 87 | userId Int @map("user_id")
|
| 88 | user User @relation(fields: [userId], references: [id])
|
| 89 |
|
| 90 | @@map("reminders")
|
| 91 | }
|
| 92 |
|
| 93 | enum IntensityLevel {
|
| 94 | LIGHT
|
| 95 | MODERATE
|
| 96 | HIGH
|
| 97 | }
|
| 98 |
|
| 99 | enum InterventionType {
|
| 100 | MEDICATION
|
| 101 | THERAPY
|
| 102 | MEDITATION
|
| 103 | EXERCISE
|
| 104 | CONVERSATION
|
| 105 | }
|
| 106 |
|
| 107 | enum TriggerType {
|
| 108 | SOCIAL
|
| 109 | ENVIRONMENTAL
|
| 110 | EMOTIONAL
|
| 111 | PHYSICAL
|
| 112 | OTHER
|
| 113 | }
|