Skip to content

Rallly is an open-source scheduling and collaboration tool designed to make organizing events and meetings easier.

Add indexes (#341)

Luke Vellaca17ebefed2d
diff --git a/prisma/migrations/20221026220835_add_indexes/migration.sql b/prisma/migrations/20221026220835_add_indexes/migration.sql
new file mode 100644
index 000000000..9c7375d0e
--- /dev/null
+++ b/prisma/migrations/20221026220835_add_indexes/migration.sql
@@ -0,0 +1,5 @@
+-- CreateIndex
+CREATE INDEX "participants_poll_id_idx" ON "participants" USING HASH ("poll_id");
+
+-- CreateIndex
+CREATE INDEX "votes_participant_id_idx" ON "votes" USING HASH ("participant_id");
diff --git a/prisma/schema.prisma b/prisma/schema.prisma
index 1cc5f5535..f8b9ebbb8 100644
--- a/prisma/schema.prisma
+++ b/prisma/schema.prisma
@@ -67,6 +67,8 @@ model Participant {
createdAt DateTime @default(now()) @map("created_at")
updatedAt DateTime? @updatedAt @map("updated_at")
+
+ @@index([pollId], type: Hash)
@@unique([id, pollId])
@@map("participants")
}
@@ -103,6 +105,7 @@ model Vote {
createdAt DateTime @default(now()) @map("created_at")
updatedAt DateTime? @updatedAt @map("updated_at")
+ @@index([participantId], type: Hash)
@@map("votes")
}