| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970 |
- generator client {
- provider = "prisma-client-js"
- }
- datasource db {
- provider = "postgresql"
- url = env("DATABASE_URL")
- }
- model User {
- id String @id @default(cuid())
- name String
- lastname String
- username String @unique
- email String @unique
- password String
- role Role @default(PATIENT)
- profileImage String?
- phone String?
- dateOfBirth DateTime?
- gender Gender?
- address String?
- emergencyContact String?
- medicalHistory String?
- allergies String?
- currentMedications String?
- createdAt DateTime @default(now())
- updatedAt DateTime @updatedAt
-
- // Relaciones
- records Record[]
- assignedPatients PatientAssignment[] @relation("DoctorPatients")
- assignedDoctor PatientAssignment[] @relation("PatientDoctor")
- }
- model PatientAssignment {
- id String @id @default(cuid())
- doctorId String
- patientId String
- assignedAt DateTime @default(now())
- notes String?
- isActive Boolean @default(true)
-
- doctor User @relation("DoctorPatients", fields: [doctorId], references: [id], onDelete: Cascade)
- patient User @relation("PatientDoctor", fields: [patientId], references: [id], onDelete: Cascade)
-
- @@unique([doctorId, patientId])
- }
- model Record {
- id String @id @default(cuid())
- userId String
- content String
- messages Json?
- createdAt DateTime @default(now())
- user User @relation(fields: [userId], references: [id], onDelete: Cascade)
- }
- enum Role {
- ADMIN
- DOCTOR
- PATIENT
- }
- enum Gender {
- MALE
- FEMALE
- OTHER
- PREFER_NOT_TO_SAY
- }
|