more thn one movie

This commit is contained in:
2025-08-19 17:43:05 +02:00
parent 361b2ed8f0
commit 8fdc99f5e5
2 changed files with 14 additions and 1 deletions

View File

@@ -0,0 +1,11 @@
/*
Warnings:
- A unique constraint covering the columns `[movieId,date]` on the table `MovieSchedule` will be added. If there are existing duplicate values, this will fail.
*/
-- DropIndex
DROP INDEX "public"."MovieSchedule_date_key";
-- CreateIndex
CREATE UNIQUE INDEX "MovieSchedule_movieId_date_key" ON "public"."MovieSchedule"("movieId", "date");

View File

@@ -86,10 +86,12 @@ model Movie {
model MovieSchedule { model MovieSchedule {
id String @id @default(cuid()) id String @id @default(cuid())
movieId String movieId String
date DateTime @unique date DateTime
createdAt DateTime @default(now()) createdAt DateTime @default(now())
updatedAt DateTime @updatedAt updatedAt DateTime @updatedAt
movie Movie @relation(fields: [movieId], references: [id], onDelete: Cascade) movie Movie @relation(fields: [movieId], references: [id], onDelete: Cascade)
@@unique([movieId, date])
} }
model Vote { model Vote {