From 8fdc99f5e51cd2c9f1d74900b6e07aad1b7a5110 Mon Sep 17 00:00:00 2001 From: Izan Gil <66965250+SrIzan10@users.noreply.github.com> Date: Tue, 19 Aug 2025 17:43:05 +0200 Subject: [PATCH] more thn one movie --- .../migration.sql | 11 +++++++++++ prisma/schema.prisma | 4 +++- 2 files changed, 14 insertions(+), 1 deletion(-) create mode 100644 prisma/migrations/20250819154208_allow_multiple_movies_per_day/migration.sql diff --git a/prisma/migrations/20250819154208_allow_multiple_movies_per_day/migration.sql b/prisma/migrations/20250819154208_allow_multiple_movies_per_day/migration.sql new file mode 100644 index 0000000..69f3ac8 --- /dev/null +++ b/prisma/migrations/20250819154208_allow_multiple_movies_per_day/migration.sql @@ -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"); diff --git a/prisma/schema.prisma b/prisma/schema.prisma index 03f2dbf..4c91ad4 100644 --- a/prisma/schema.prisma +++ b/prisma/schema.prisma @@ -86,10 +86,12 @@ model Movie { model MovieSchedule { id String @id @default(cuid()) movieId String - date DateTime @unique + date DateTime createdAt DateTime @default(now()) updatedAt DateTime @updatedAt movie Movie @relation(fields: [movieId], references: [id], onDelete: Cascade) + + @@unique([movieId, date]) } model Vote {