From 8be76549051aafa145029f9d3d2c5973dcfff443 Mon Sep 17 00:00:00 2001 From: Roman Godmaire Date: Sun, 19 Nov 2023 17:19:19 -0500 Subject: [PATCH] refactor: Rearrange schema --- prisma/schema.prisma | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/prisma/schema.prisma b/prisma/schema.prisma index dfdf7ee..2e48160 100644 --- a/prisma/schema.prisma +++ b/prisma/schema.prisma @@ -42,22 +42,29 @@ model Track { id Int @id @default(autoincrement()) title String objectKey String - versions TrackVersion[] + producer User @relation(fields: [producerId], references: [id], onDelete: Cascade) producerId String + + versions TrackVersion[] } model TrackVersion { id Int @id @default(autoincrement()) + track Track @relation(fields: [trackId], references: [id], onDelete: Cascade) trackId Int + comments Comment[] } model Comment { id Int @id @default(autoincrement()) + content String + author User @relation(fields: [authorId], references: [id]) authorId String + trackVersion TrackVersion @relation(fields: [trackVersionId], references: [id], onDelete: Cascade) trackVersionId Int }