diff --git a/apps/portal/prisma/migrations/20221014105030_add_question_content_search/migration.sql b/apps/portal/prisma/migrations/20221014105030_add_question_content_search/migration.sql deleted file mode 100644 index 2aed7085..00000000 --- a/apps/portal/prisma/migrations/20221014105030_add_question_content_search/migration.sql +++ /dev/null @@ -1,8 +0,0 @@ --- AlterTable -ALTER TABLE "QuestionsQuestion" ADD COLUMN "contentSearch" TSVECTOR - GENERATED ALWAYS AS - to_tsvector('english', coalesce(content, '')) - STORED; - --- CreateIndex -CREATE INDEX "QuestionsQuestion_contentSearch_idx" ON "QuestionsQuestion" USING GIN("textSearch"); \ No newline at end of file diff --git a/apps/portal/prisma/migrations/20221025172425_add_full_text_search/migration.sql b/apps/portal/prisma/migrations/20221025172425_add_full_text_search/migration.sql new file mode 100644 index 00000000..a52b7ebf --- /dev/null +++ b/apps/portal/prisma/migrations/20221025172425_add_full_text_search/migration.sql @@ -0,0 +1,5 @@ +-- AlterTable +ALTER TABLE "QuestionsQuestion" ADD COLUMN "contentSearch" tsvector; + +-- CreateIndex +CREATE INDEX "QuestionsQuestion_contentSearch_idx" ON "QuestionsQuestion" USING GIN ("contentSearch"); diff --git a/apps/portal/prisma/schema.prisma b/apps/portal/prisma/schema.prisma index 42f1b974..fad7f441 100644 --- a/apps/portal/prisma/schema.prisma +++ b/apps/portal/prisma/schema.prisma @@ -415,9 +415,9 @@ model QuestionsQuestion { comments QuestionsQuestionComment[] answers QuestionsAnswer[] - contentSearch Unsupported("TSVECTOR")? + contentSearch Unsupported("tsvector")? @default(dbgenerated()) - @@index([contentSearch]) + @@index([contentSearch], type: Gin) @@index([lastSeenAt, id]) @@index([upvotes, id]) }