From f8e770c8757b93e751ddb117f7d303600ec0b517 Mon Sep 17 00:00:00 2001 From: Baptiste Arnaud Date: Thu, 20 Oct 2022 08:20:43 +0200 Subject: [PATCH] :card_file_box: Add typebotId index on Result table --- .../20221020070814_remove_duplicate_answer_index/migration.sql | 2 ++ .../migration.sql | 2 ++ packages/db/prisma/schema.prisma | 3 ++- 3 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 packages/db/prisma/migrations/20221020070814_remove_duplicate_answer_index/migration.sql create mode 100644 packages/db/prisma/migrations/20221020070833_add_typebot_id_index_in_result/migration.sql diff --git a/packages/db/prisma/migrations/20221020070814_remove_duplicate_answer_index/migration.sql b/packages/db/prisma/migrations/20221020070814_remove_duplicate_answer_index/migration.sql new file mode 100644 index 000000000..8eb4e8100 --- /dev/null +++ b/packages/db/prisma/migrations/20221020070814_remove_duplicate_answer_index/migration.sql @@ -0,0 +1,2 @@ +-- DropIndex +DROP INDEX "Answer_resultId_idx"; diff --git a/packages/db/prisma/migrations/20221020070833_add_typebot_id_index_in_result/migration.sql b/packages/db/prisma/migrations/20221020070833_add_typebot_id_index_in_result/migration.sql new file mode 100644 index 000000000..36d8fbfdd --- /dev/null +++ b/packages/db/prisma/migrations/20221020070833_add_typebot_id_index_in_result/migration.sql @@ -0,0 +1,2 @@ +-- CreateIndex +CREATE INDEX CONCURRENTLY "Result_typebotId_idx" ON "Result"("typebotId"); diff --git a/packages/db/prisma/schema.prisma b/packages/db/prisma/schema.prisma index 1405b4814..8fb454247 100644 --- a/packages/db/prisma/schema.prisma +++ b/packages/db/prisma/schema.prisma @@ -217,6 +217,8 @@ model Result { typebot Typebot @relation(fields: [typebotId], references: [id], onDelete: Cascade) answers Answer[] logs Log[] + + @@index([typebotId]) } model Log { @@ -242,7 +244,6 @@ model Answer { result Result @relation(fields: [resultId], references: [id], onDelete: Cascade) @@unique([resultId, blockId, groupId]) - @@index([resultId]) } model Coupon {