diff --git a/prisma/schema.prisma b/prisma/schema.prisma index 70d0038..2453021 100644 --- a/prisma/schema.prisma +++ b/prisma/schema.prisma @@ -130,6 +130,9 @@ model Person { email String? phone String? + teamId String? @db.Uuid + team Team? @relation(fields: [teamId], references: [id], onDelete: SetNull, onUpdate: Cascade) + userId String? @unique @db.Uuid user User? @relation(fields: [userId], references: [id], onDelete: SetNull, onUpdate: Cascade) @@ -141,9 +144,20 @@ model Person { @@index([lastName, firstName]) @@index([department, deletedAt]) + @@index([teamId, deletedAt]) + @@index([teamId]) @@index([deletedAt]) } +model Team { + id String @id @default(uuid(7)) @db.Uuid + name String + createdAt DateTime @default(now()) + updatedAt DateTime @updatedAt + + people Person[] +} + // ====================================================== // CATALOG // ======================================================